What is the command to view a directory in Linux?

WBOY
Release: 2021-12-27 17:37:46
Original
25030 people have browsed it

Linux can use the "ls" command to view the directory. The ls command is the abbreviation of "list" and is applicable to all user permissions. Its main function is to display directory files in list form. The syntax is "ls option directory name".

What is the command to view a directory in Linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is the command to view directories in Linux

The command to view files and directories in Linux is: LS

LS English Original meaning: list, the path where the command is located: /bin/ls, applicable to all user permissions, the main function is to display directory files in list form.

The syntax: ls option [-ald][file or directory]

Among them,

  • -a displays all files, including hidden files;

  • -l Detailed information display;

  • -d Only displays the directory name, not the content list under the directory;

  • -h Humanized display (hommization);

  • -i View the i node of any file (similar to the unique information of an ID card);

  • -t Sort by the change time of files and directories; you can use the first displayed file to determine the most recently modified file;

Note: Beginning with . Unless the file is a directory, it is a hidden file

What is the command to view a directory in Linux?

##Extension information:

Create directory command: mkdir, original English meaning: make directories, command path: /bin/mkdir, applicable to all user permissions, is used to create new directories.

The syntax: mkdir [-p][directory name]

-p Recursive creation

Example: a) Create a single directory: mkdir /tmp/vae.txt

b) Create multiple directories: mkdir /tmp/a.txt /tmp/b.txt

What is the command to view a directory in Linux?

Notes when using:

1. The created directory already exists, then Linux will prompt us that Linux cannot create it.

2. Running the mkdir command without any parameters will create a directory in the current directory.

3. Without -p, it is wrong to say that if the upper-level directory of the newly created file does not exist, it will not be executed successfully. With or without -p, the previous directories will be created sequentially.

4. The first condition for creating a directory is that you must have access permissions in the target path where you want to create the directory.

Related recommendations: "

Linux Video 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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template