Which command lists the contents of the current directory?

Study for the SANS560 GIAC Penetration Tester (GPEN) Test. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for your exam!

Multiple Choice

Which command lists the contents of the current directory?

Explanation:
Listing what resides in the current directory is done by a command that enumerates directory entries. In Unix-like shells, that command is ls. It prints the names of files and subdirectories in the current directory, and you can enhance it with options such as -l for a detailed listing or -a to show hidden items. The other commands don’t fit because pwd shows the path of the current directory rather than its contents; getwd isn’t a standard shell command for listing files; and cat displays the contents of a file, not the list of items in a directory.

Listing what resides in the current directory is done by a command that enumerates directory entries. In Unix-like shells, that command is ls. It prints the names of files and subdirectories in the current directory, and you can enhance it with options such as -l for a detailed listing or -a to show hidden items. The other commands don’t fit because pwd shows the path of the current directory rather than its contents; getwd isn’t a standard shell command for listing files; and cat displays the contents of a file, not the list of items in a directory.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy