What is the use of the ls command in UNIX?

What is the use of the ls command in UNIX?

a) It lists files and directories in the current directory
b) It creates a new directory
c) It deletes a file
d) It changes the current directory

Answer:

a) It lists files and directories in the current directory

Explanation:

The ls command in UNIX is used to list the contents of a directory. When you type ls in the terminal, it will display all the files and subdirectories present in the current directory. It’s a fundamental command for understanding what’s inside a directory.

There are multiple options with the ls command to display more detailed information, such as ls -l for a long listing format or ls -a to show hidden files. These variations are essential for users who need more control over file viewing.

Mastering the ls command is a basic but crucial skill for UNIX users. By knowing how to view files and directories effectively, you can navigate and manage your file system more efficiently.

Reference:

Top 50 Unix MCQ Questions & Answers

Scroll to Top