Home  >  Article  >  Operation and Maintenance  >  How to view files in linux

How to view files in linux

(*-*)浩
(*-*)浩Original
2019-11-06 15:28:2130953browse

How to view files in linux

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

The original English meaning of LS: 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] (Recommended learning: linux operation and maintenance)

Among them , -a displays all files, including hidden files;

-l displays detailed information;

-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 Use files and directories Change the time sorting; you can use the first displayed file to determine the most recently modified file;

Example:

[root@www ~]# ls -al ~
total 156
drwxr-x---  4 root root  4096 Sep 24 00:07 .
drwxr-xr-x 23 root root  4096 Sep 22 12:09 ..
-rw-------  1 root root  1474 Sep  4 18:27 anaconda-ks.cfg
-rw-------  1 root root   955 Sep 24 00:08 .bash_history
-rw-r--r--  1 root root    24 Jan  6  2007 .bash_logout
-rw-r--r--  1 root root   191 Jan  6  2007 .bash_profile
-rw-r--r--  1 root root   176 Jan  6  2007 .bashrc
drwx------  3 root root  4096 Sep  5 10:37 .gconf
-rw-r--r--  1 root root 42304 Sep  4 18:26 install.log
-rw-r--r--  1 root root  5661 Sep  4 18:25 install.log.syslog

By using -a, you will see . The first few files, as well as directory files (.), (..), .gconf, etc., are all hidden directories and files. Among them, directory file names are displayed in blue, and general files are displayed in white.

注意,Linux 系统中,隐藏文件不是为了把文件藏起来不让其他用户找到,而是为了告诉用户这些文件都是重要的系统文件,如非必要,不要乱动!所以,不论是 Linux 还是 Windows 都可以非常简单地査看隐藏文件,只是在 Windows 中绝大多数的病毒和木马都会把自己变成隐藏文件,给用户带来了错觉,以为隐藏文件是为了不让用户发现。

Not only that, the ls command here also uses the -l option, so the detailed information of the file is displayed. The meanings of the 7 columns displayed by this option are:

The first column: stipulates the permissions that different users have on files. The meaning of specific permissions will be explained in subsequent chapters.

Second column: Reference count. The reference count of a file represents the number of hard links to the file, while the reference count of the directory represents how many first-level subdirectories the directory has.

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

The fourth column: the group to which the file belongs. The default group to which the file belongs is the effective group of the user who created the file. Generally, it is the group of the user who created the file.

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 creation time of the file.

The seventh column: file name or directory name.

The above is the detailed content of How to view files 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