Courseiva
Shells, Scripting and Data ManagementeasyMultiple ChoiceObjective-mapped

LPIC-1 Shells, Scripting and Data Management Practice Question

A user frequently runs 'ls -la' and wants to create an alias 'll' for this command. Which command adds this alias persistently?

⚠ Common exam trap

Watch out — candidates often think the `alias` command alone (Option C) is sufficient for persistence, or they confuse `export` with alias creation (Option A), not realizing that `alias` is a shell built-in that only affects the current session and must be added to a startup file to survive reboots.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

alias ll='ls -la' && echo "alias ll='ls -la'" >> ~/.bashrc

It first creates the alias in the current shell session with the `alias` command, then appends the same alias definition to `~/.bashrc` to make it persistent across new shell sessions. The `&&` ensures the second command runs only if the first succeeds, and `~/.bashrc` is the standard file for user-specific Bash aliases that are sourced on interactive shell startup.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • export ll='ls -la'

    Why it's wrong here

    Export is for environment variables, not aliases; does not work.

  • echo "alias ll='ls -la'" >> ~/.bashrc

    Why it's wrong here

    Appends the alias to ~/.bashrc but does not activate it in the current session.

  • alias ll='ls -la'

    Why it's wrong here

    Creates a temporary alias only for the current shell session.

  • alias ll='ls -la' && echo "alias ll='ls -la'" >> ~/.bashrc

    Why this is correct

    Creates the alias immediately and persists it to ~/.bashrc.

About these practice questions

One of 527 original LPIC-1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.