Home  >  Article  >  Operation and Maintenance  >  What is the command to view a directory in Linux?

What is the command to view a directory in Linux?

王林
王林Original
2020-05-18 16:11:375323browse

What is the command to view a directory in Linux?

Under Linux, you can use the ls command to view the directory.

ls command can list all contents in the current directory.

The syntax format of the ls command is:

# ls  [-选项]  [文件名或者目录名]

In Linux, the ls command is one of the most commonly used commands, because the directory contents must be viewed at any time on the command line. If you do not add any options, the ls command only lists the files and directory names in the current directory. For example, if you want to view the contents of the /etc directory, you can use the following command:

# ls /etc

If you want to To list all files in the current directory, you can use the following command:

# ls -a

Recommended tutorial: linux tutorial

The above is the detailed content of What is the command to view a directory in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn