Select the THREE true statements about ls options.
LPIC-1 Exam 101-500, objective 103. GNU and Unix commands medium
Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.
Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.
How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.
The options
Choose 3.
Correct ls -ld /var/log shows the properties of the directory itself rather than a listing of what is inside it.
Correct. -d treats a directory operand as an ordinary file, which combined with -l is the standard way to inspect a directory's own permissions and owner.
Correct ls -a includes entries whose names begin with a dot.
Correct. Dot files are hidden only by convention — the tools simply skip them unless asked. -A is the same but omits the . and .. entries.
Correct ls -i prints each entry's inode number alongside its name.
Correct. It is how you confirm that two names are hard links to the same file: identical inode numbers on the same filesystem mean one file with two directory entries.
Not correct ls -l sorts the listing by modification time, newest first.
Wrong. -l selects the long format only; the order stays alphabetical. Sorting by modification time is -t, and -r reverses whichever order is in effect.
Not correct ls -R prints the listing in reverse alphabetical order.
Wrong. -R recurses into subdirectories. The reversing option is the lowercase -r, a distinction several coreutils tools share.
Why
ls separates what is listed from how it is shown and in what order. -a and -d change the set of entries, -l, -i and -h change the presentation, and -t, -S and -r change the order. The pairing of a lowercase and an uppercase letter for unrelated jobs, as with -r and -R, is a frequent source of mistakes and a frequent exam target.
Where this comes from
- Cited
- manual page ls(1)
Practise this
Reading one question is not practice. The trainer will draw a short set from objective 103 and space the ones you get wrong.
More questions on this objective
- A user starts a new terminal window in a running graphical desktop session, which launches bash as an interactive shell that is NOT a login shell. Which file in the user's home directory does bash read in that case? machine-checked
- In bash, which history expansion re-runs the entire previous command line? machine-checked
- Which bash command prints the literal five characters $USER instead of the current user name? machine-checked
- You want /opt/bin searched for executables, after all the directories already in PATH, in the current bash session and in every command started from it. Which command does that? machine-checked
- There is a passwd manual page in section 1 (the command) and another in section 5 (the /etc/passwd file format). Which command opens the section 5 page? machine-checked
- Select the TWO true statements about shell variables and the environment in bash. machine-checked