Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Which is the command for linux to view all files

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

The main content of this article is to explain "which is the command for linux to view all files". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "which is the command for linux to view all files?"

The linux view all files command is "ls". The ls command displays all files in the specified directory with the syntax "ls [options] directory name". If the option is set to "- a", all files can be displayed, including hidden files; if the option is "- A", the text shows all files, along with hidden files, but does not include "." And "..." Catalogue.

The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

The linux view all files command is "ls".

The ls command, which stands for list, is the most common directory operation command, and its main function is to display the contents of the current directory. The basic format of this command is:

Ls [options] directory name

The ls command displays options for all files:

Option function-a displays all files, including hidden files (beginning with. Is also listed together, which is one of the most commonly used options. -A shows all files, along with hidden files, but does not include. With; with. These two directories.

Other options:

The option feature-d lists only the directory itself, not the file data within the directory. -fls sorts by file name by default, and using the-f option lists the results directly without sorting. -F add an indication of the file type after the file or directory name, for example, * for runnable files, / for directories, = for socket files, | for FIFO files. -h displays the file or directory size in a way that is easy for people to read, such as 1KB, 234MB, 2GB, etc. -I displays inode node information. -l lists file and directory information in a long format. -n is displayed with UID and GID instead of file user name and group name, respectively. -r outputs the sort result in reverse, for example, if the original file name is from small to large, the reverse is from large to small. -R is listed together with the contents of the subdirectory, which means that all the files in that directory are displayed. -S is sorted by file capacity size, not by file name. -t is sorted by time, not by file name. -- color=never

-- color=always

-- color=autonever means that the color display is not given according to the characteristics of the file.

Always represents the display color, which is the default for ls.

Auto says let the system decide whether or not to give color according to the configuration. -- full-time outputs in full time mode (including year, month, day, hour, minute)-- time= {atime,ctime} outputs access time or change permission attribute time (ctime) instead of content change time.

Note that when the ls command does not use any options, by default only the names of the non-hidden files are displayed and sorted by the file name, and the file name is colored according to the specific type of file (blue shows the directory, white shows the general file).

[example 1] ls-al ~

By using-a, you will see that. The first few files, as well as directory files (.), (.), .gconf, and so on, are hidden directories and files. Among them, the directory file name is shown in blue and the general file is shown in white.

Note that in the Linux system, hiding files is not to hide files from other users, but to tell users that these files are important system files, if not necessary, do not move! Therefore, both Linux and Windows can easily look at hidden files, but the vast majority of viruses and Trojans in Windows will turn themselves into hidden files, giving users the illusion that hidden files are intended not to be discovered by users.

Not only that, the ls command here also uses the-l option, which shows the details of the file, which shows the meaning of the seven columns:

The first column: specifies the permissions that different users have on the file, and the meaning of the specific permissions will be explained in subsequent chapters.

The second column: reference count, the reference count of a file represents the number of hard links to the file, and the reference count of a directory represents how many first-level subdirectories there are in that directory.

The third column: the owner, that is, the user to which the file belongs. The default owner is the user who created the file.

The fourth column: belongs to the group, the default belongs to the group is the file to establish the user's valid group, generally is to establish the user's group.

The fifth column: size, the default unit is bytes.

The sixth column: file modification time, file status modification time or file data modification time will change this time, note that this time is not the file creation time.

The seventh column: file name or directory name.

[example 2] View the details of a directory

Ls-l / root/

This command displays the contents of the directory instead of the details of the directory itself. If you want to display information about the directory itself, you must add the "- d" option.

Ls-ld / root/

At this point, I believe you have a deeper understanding of "which is the command for linux to view all files". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report