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. -tConceptCommand-line options can control different dimensions: which entries are included, how output is formatted, which timestamp is selected, and how…

  1. A.

    -t

  2. B.

    -m

  3. C.

    -a

  4. 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

  1. The requested operation is sorting, not changing which entries appear or how the list is formatted.

  2. The requested sort key is each entry’s modification time.

  3. The -t flag requests time-based sorting, and modification time is the default timestamp for that ordering.

Contrast

  • -m produces comma-separated output; it is a formatting control.

  • -a includes entries beginning with a dot; it is an inclusion control.

  • -u selects access time, which is a different timestamp from modification time.

Cross-check

  1. Create two entries with different modification times.

  2. Run ls -t; the more recently modified entry appears first.

  3. This behavior directly matches sorting by modification time.

Therefore, the required option value is -t.

Explore the full course: Up Police Computer Operator

Loading lesson…