stay linux Next use “ls -l” perhaps “ls
-al” perhaps “ll” Command to view file and directory details ,shell Several columns of information are displayed in . I didn't pay much attention to it , It's just a whim today to find out , So I organized this blog , For reference :

First, a typical display result is given :

Each of these columns is analyzed in detail below :

One , file type

Indicates the type of the file :

* “-” Represents a common file ;
* “d” Table of contents ;
* “l” Represents a linked file ;
* “p” Management file ;
* “b” Represents a block device file ;
* “c” Represent character device file ;
* “s” Represents a socket file ;
Two , File properties

with back_init File as an example , Its attributes can be divided into three sections :[rwx][rwx][r-x], among :

The first paragraph indicates the creator of the document / The owner's permissions for the file , The second paragraph indicates the Creator / Permissions for other users of the group that the owner is in , The third paragraph indicates the permissions of other users in other groups .

* r(Read, Read permission ): For documents , Have permission to read the contents of the file ; For a catalog , Have permission to browse directory .
* w(Write, Write permission ): For documents , With new , Permission to modify file content ; For a catalog , With delete , Permission to move files in the directory .
* x(eXecute, Execution Authority ): For documents , Have permission to execute files ; For a catalog , The user has access to the directory .
in addition , There's more here 2 A very special property , Not very common at ordinary times , Let's explain by the way :

* s or S(SUID,Set UID)
: The executable file matches this permission , Then you can get the privilege , All system resources available to any owner accessing the file . Please note that SUID Files for permissions , Hackers often take advantage of this privilege , with SUID With root Account owner , Quietly open a back door in the system , For future access .
* t or T(Sticky):/tmp and /var/tmp Directory for all users to temporarily access files , That is, each user has full access to the directory , To browse , Delete and move files .

All in all , about back_init file , Its creator / The owner has read-write executable rights , Its creator / Other users of the group that the owner is in have read-write executable rights , Other users of other groups have read, execute, but not write permissions .

Three , catalog / Number of links

For catalog files , Indicates the number of its first level subdirectories . Note that the values seen here should be reduced 2 Is equal to the actual number of subdirectories under the directory .


Like here include Directory , There is no subdirectory , So it should be 0, But here it shows 2, This is because of the addition of . Contents and .. catalog . stay linux lower ,. Directory represents the current directory ,.. Directory represents the upper level directory .


This also explains the first line . Under directory 3 And the second line .. Under directory 26. Because there is one in the current directory include catalog , So add . Contents and .. Catalog here 2 Directory is equal to 3, So the first line will show 3. And the upper level directories share the same 24 Directories , Plus the . Contents and .. Catalog here 2 Directories , So the second line here shows 26.

For other documents , Indicates the number of linked files to it .

Four , Owners and groups

Represents the owner of the file / creator (owner) And its group (group).

Five , file size

If it's a file , Indicates the size of the file , In bytes .
If it's a directory , Indicates the size of the directory character , Does not indicate the size of all files in the directory .

Six , modification date

Date and time of the last modification of the file .

Seven , File name

file name , No need to say more .

Eight , Font color

In most linux shell In window , Color can also be used to distinguish the attributes of different files :

* Gray white means ordinary document ;
* Bright green indicates executable ;
* Bright red indicates compressed files ;
* Gray blue indicates the directory ;
* Bright blue indicates linked files ;
* Bright yellow indicates device file ;
of course , You need to use the system's default color scheme here . If you customize shell Color scheme of , It may be inconsistent with the above definition .

The last thing I want to say is , You can see in the picture above ,back_init There is also an asterisk at the back of the file (*), This is also linux Another way to mark executable files under the system . in other words , All filenames are followed by an asterisk (*) Of , It means that this is an executable file .

©2019-2020 Toolsou All rights reserved,
( Essence 2020 year 6 month 2 Daily update ) TypeScript Function explanation Output string at specified position --PTA Conflict statement (conflicting declaration) solve @Repository The role of annotations el-select Get selected label value java Several common runtime exceptions and simple examples experiment 11-1-6 Output string at specified position (20 branch )( Essence )2020 year 7 month 15 day Wechat applet assembly Component Use of Java Thread of Sleep() Summary of usage The project followed for a year , The customer finally said no