LS English full name: list is the meaning of lists, is one of the most frequently used in Linux system commands, I believe that the LS command must be you enter a Linux system of the computer to open a command prompt after the first command to use. We use the LS command frequently every day. In this article, I discuss as much as possible some of the more important common LS command parameters.
In addition , it is interesting to say that when we learn something, we need to know the reason why, when you know that this thing is probably what your thinking will be associated with a lot of things will soon learn. So it is necessary to learn the LS command well.
Command format:
LS [options] [directory name]
Command function:
Lists all subdirectories and files in the destination directory.
Common parameters:
-a,–all lists all files under the directory, including the. The implied file at the beginning
-A with-a, listed in addition to "." (represents the current directory) and ".." (representing the parent directory of the current directory)
- C mate-lt: Sort and display CTime based on CTime (the time the file state last changed) mate-L: Show CTime but sort by name otherwise: Sort by CTime
–color[=when] Controls whether to use color-resolved files. When can be ' never ', ' always ' or ' auto ' one of them, you can use aliases alias ls= "ls--color=auto" for ease of use
-d,–directory Displays the directory as a file, rather than displaying the file below it
-h,–human-readable list file sizes in an easy-to-understand format (e.g. 1K 234M 2G)
-i,–inode Prints the inode number of each file
-l lists the permissions, owner, file size, and so on, in addition to the file name.
-l,–dereference when displaying the file information for a symbolic link, displays the object indicated by the symbolic link instead of the information of the symbolic link itself
-r,–recursive listing all subdirectory tiers at the same time
-s sort by file size
-T sorted by file modification time
-1 list only one file per line
Help display this help message and leave
–version display version information and leave
Extended:
Calculate the number of files in the current directory
Ls-l *|grep "^-" | Wc-l
The meaning of some file colors in Linux files
Display a list of color catalogs
Open/ETC/BASHRC and add the following line:
Alias ls= "LS--color"
The next time you start bash, you'll be able to display a list of colored catalogs as you would in Slackware, where the meanings of colors are as follows:
1. Blue---Directory
2. Green---executable file
3. Red--Compress files
4. Light blue--linked files
5. Gray--Other files
Common demonstrations:
Example one: List the details of all files in/tmp, including hidden files starting with.
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/8B/A1/wKioL1hTbfigXbw9AABtEOySk3A204.png-wh_500x0-wm_3 -wmp_4-s_808437731.png "title=" qq picture 20161216123017.png "Width=" "height=" 117 "border=" 0 "hspace=" 0 "vspace=" 0 " Style= "WIDTH:600PX;HEIGHT:117PX;" alt= "Wkiol1htbfigxbw9aabteoysk3a204.png-wh_50"/>
Example two: List all files and directories starting with 1 in/tmp
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8B/A5/wKiom1hTdCTBBW2zAAAwLb-zSQQ726.png-wh_500x0-wm_3 -wmp_4-s_2619373909.png "title=" qq picture 20161216125644.png "Width=" "height=" 131 "border=" 0 "hspace=" 0 "vspace=" 0 " Style= "width:600px;height:131px;" alt= "Wkiom1htdctbbw2zaaawlb-zsqq726.png-wh_50"/>
Suddenly I don't feel the need
Linux command ls