LS is the abbreviation of the list to see the file information under the folder, here are a few common examples.
1 sorts all the files under the folder according to CTime (the last time the file was changed).
Ls-lct
2 Show All files,-G does not show the owner of the file,-O does not show the group of owners
Ls-g Ls-o
3 Display the file size in human-read form
Ls-lh
4 Display the file as a comma-delimited line
Ls-m
5 Show All Files under folder
Ls-r
6 Ls-s Sort by file size ls-x sorted by file name extension
7 Ls-f can be appended to the list of files with a symbol, "*" for the executable of ordinary files; "/" for directories; "@" for symbolic links; "|" Represents FIFOs; "=" means socket
The following command indicates that subfolders are found in the folder
Ls-f | grep/$
Or use the following methods
Ls-l | grep ^d
8 Calculating the number of folders and files in a folder
Ls-l *
Used to calculate all files and folders in the current folder level directory
LS-LR *
Used to calculate all files and subdirectories under a directory
Ls-l * | grep ^-| Wc-l
Used to calculate all folders under a directory for all files and subdirectories
Ls-l * | grep ^d | Wc-l
Note here that the result of the WC display corresponds to the-L line number-m character number-C byte number, if the number of characters with the parameter-m, the number of words to calculate the parameter-W
9 absolute path for all files under the output folder
echo b |sed "s/^/' echo a '/"
Seb S represents a replacement, the above operation means to execute output B and append output A to the previous operation
where/can replace with alternative rich
echo b |sed "s:^: ' pwd '/:"
Represents an operation that performs a PWD plus "/" before performing an operation on output b
ls | Sed "s:^: ' pwd '/:"
Indicates the absolute path of all files under the list folder
10 lists the absolute paths of all files in the current directory, and subdirectories do not recursively
Find $PWD
$PWD represents the current directory string, find $pwd represents a lookup in the current directory
Find $PWD-maxdepth 1
-maxdepth means that only one layer is recursive
Find $PWD-maxdepth 1 | Xargs Ls-ld
Where Xargs is used to receive the preceding arguments.
Reference Document: Http://www.cnblogs.com/peida/archive/2012/10/23/2734829.html
Linux command 1--ls