ls
"function description": The ls command is the most commonly used command under Linux. ls command is the abbreviation of the list, the lack of saving LS used to print out the current directory of the list, if LS specifies a different directory, then the specified directory of files and folders will be displayed list.
"Syntax format": ls [options] [directory name]
"Option Parameters":
-A lists all files in the directory, including the implied files that begin with.
-B lists the characters that are not output in the file name in the form of a backslash and a character number (as in the C language).
-C The modified time of the I node of the output file and sorted by this.
-D Displays the directory as if it were a file, rather than displaying the file below it.
-e outputs the full information of the time, not the output of the brief information.
-f-u the output file is not sorted.
-G useless.
-I index information for the I node of the output file.
-K represents the size of a file in the form of a byte.
-l lists the file details.
-m output file name horizontally and "," as a separator.
-N replaces the name with the uid,gid of the number.
-O Displays detailed information about the file in addition to the group information.
-p-f a character after each file name to indicate the type of the file, "*" means an executable plain file; "/" means a directory; "@" denotes a symbolic link; "|" Represents FIFOs; "=" represents a socket (sockets).
-Q replaces non-output characters.
-R sorts the directory backwards.
-S prints the size of the file after each file name.
-T is sorted by time.
-U sorts the time the file was last accessed.
-X output by column, sorted horizontally.
-a displays except for "." and ".." All files outside the file.
-B does not output backup files ending with "~".
-C output By column, sorted vertically.
-G output file for the group information.
-l lists the link file name instead of the file that is linked to.
-N does not limit file length.
-Q Enclose the file name of the output in double quotation marks.
-r lists all the files under subdirectories.
-S is sorted by file size.
-X sorts with the file's extension (the last character after the.).
-11 lines output only one file.
–color=no do not display color file names
The help displays help information on the standard output.
The –version outputs the version information on the standard output and exits.
"Practice Actions":
1, LS display file information description:
[[Email protected]]# Ls-lhta
Drwxr-xr-x 2 mailbackup mailbackup 24K Oct 02:02 qumailxxx
1th field: File attribute field
The file attribute field has a total of 10 letters, the first letter indicates the file type, if the letter is a minus "-", then the file is a normal file.
The letter "D" means that the file is a directory, the letter "D", is an abbreviation for the Dirtectory (directory).
2nd field: Number of hard-link files or directory subdirectories
3rd Field: File owner
4th field: The group where the owner of the file resides
5th field: File File Size (in bytes)
6th field: File Creation Month
7th field: File creation date
8th field: File creation time
9th field: File name (if it is a symbolic link, there will be a "-a" arrow symbol followed by a file it points to)
List subdirectories only
Ls-f | grep/$
Ls-l | grep "^d" |awk ' {print $9} ' (common)
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 –> Compressed file
4. Light blue –> link file
5. Grey –> Other files
This article is from the "Cornerboy" blog, make sure to keep this source http://cornerboy.blog.51cto.com/10012663/1651570
Linux Small white-basic command-ls