The Linux command to view all files is "ls". The ls command can display all files in the specified directory. The syntax is "ls [option] directory name". If the option is set to "-a", all files, including hidden files, can be displayed; if the option is "-A", all files, including hidden files, are displayed, but the "." and ".." directories are not included.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
The Linux command to view all files is "ls".
ls command, the abbreviation of list, is the most common directory operation command. Its main function is to display the contents of the current directory. The basic format of this command is:
ls [选项] 目录名称
ls command displays options for all files:
Function | |
---|---|
Displays all files, including hidden files (files starting with .), which are also listed together. This is one of the most commonly used options. | |
Display all files, including hidden files, but excludes the . and .. directories. |
Function | |
---|---|
Only lists the directory itself, not the file data within the directory. | |
ls defaults to sorting by file name. Using the -f option will list the results directly without sorting. | |
Add the file type indicator after the file or directory name, for example, * represents a executable file, / represents a directory, = represents a socket file, | stands for FIFO file. | |
Display file or directory size in a human-readable way, such as 1KB, 234MB, 2GB, etc. | |
Display inode node information. | |
Use long format to list file and directory information. | |
UID and GID are displayed instead of the file user name and group name respectively. | |
Output the sorting results in the reverse direction. For example, if the original file names are from small to large, the reverse is from large to small. | |
Listing together with the contents of the subdirectory is equivalent to displaying all files in the directory. | |
Sort by file size, not by file name. | |
Sort by time, not by file name. | |
--color=always --color=auto | never means that the color display is not based on the file characteristics.
always means displaying color, ls adopts this method by default. auto means to let the system determine whether to give color based on the configuration. |
Output in full time mode (including year, month, day, hour, minute) | |
Output access time or change permission attribute time (ctime), not content change time. |