Which option in the UNIX ls command sorts files and directories by…
2021
Which option in the UNIX ls command sorts files and directories by modification time?
Answer: A. -t — ConceptCommand-line options can control different dimensions: which entries are included, how output is formatted, which timestamp is selected, and how…
- A.
-t - B.
-m - C.
-a - D.
-u
Show answer & explanation
Correct answer: A
Concept
Command-line options can control different dimensions: which entries are included, how output is formatted, which timestamp is selected, and how entries are ordered.
For a flag-identification question, first identify the requested operation and data field, then match both to the documented option semantics.
Application
The requested operation is sorting, not changing which entries appear or how the list is formatted.
The requested sort key is each entry’s modification time.
The
-tflag requests time-based sorting, and modification time is the default timestamp for that ordering.
Contrast
-mproduces comma-separated output; it is a formatting control.-aincludes entries beginning with a dot; it is an inclusion control.-uselects access time, which is a different timestamp from modification time.
Cross-check
Create two entries with different modification times.
Run
ls -t; the more recently modified entry appears first.This behavior directly matches sorting by modification time.
Therefore, the required option value is -t.