220-1102 · Question #416
Which of the following ls command options is used to display hidden files and directories?
The correct answer is A. -a. To display hidden files and directories in Linux and Unix-like systems, the ls -a command option is used.
Question
Which of the following ls command options is used to display hidden files and directories?
Options
- A-a
- B-s
- C-lh
- D-t
How the community answered
(31 responses)- A90% (28)
- C6% (2)
- D3% (1)
Why each option
To display hidden files and directories in Linux and Unix-like systems, the `ls -a` command option is used.
In Linux and Unix-like operating systems, files and directories that begin with a dot (.) are considered hidden and are not shown by default with the `ls` command. The `ls -a` option (or `--all`) specifically instructs the `ls` command to list all entries, including these hidden dotfiles and dotdirectories.
The `ls -s` option displays the size of each file in blocks.
The `ls -l` option displays files in a long listing format, and `h` is for human-readable sizes, but neither alone nor together shows hidden files.
The `ls -t` option sorts the output by modification time, with the newest files appearing first.
Concept tested: Linux/Unix ls command options
Source: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/configuring_basic_system_settings/listing-files-and-directories_configuring-basic-system-settings
Topics
Community Discussion
No community discussion yet for this question.