TestOut Linux Pro Practice Test 2025 – All-in-One Guide to Master Your Certification!

Image Description

Question: 1 / 400

Which command lists files in a directory sorted by modification time?

ls -a

ls -t

The command that lists files in a directory sorted by modification time is indeed `ls -t`. This command modifies the standard behavior of the `ls` command to display files in order based on the time they were last modified, with the most recently modified files appearing first.

The sorting by modification time is particularly useful for keeping track of new or recently changed files in a directory, allowing users to quickly identify recent activity. This feature can be crucial for tasks like debugging, maintaining file systems, or simple file management.

The other options serve different purposes:

- `ls -a` lists all files, including hidden files (those starting with a period), but does not sort them by modification time.

- `ls -l` provides a detailed listing of files, showing permissions, owner, size, and the last modification date for each file, but it does not inherently sort them.

- `ls -r` reverses the order of the files listed by the default sorting method, which is typically alphabetical, rather than sorting by modification time.

Thus, `ls -t` is specifically designed for the purpose of sorting files by their modification time, making it the correct choice in this context.

Get further explanation with Examzify DeepDiveBeta

ls -l

ls -r

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy