Linux Common Commands-ls

Source: Internet
Author: User

Ls


Introduction :

The LS command is used to display the target list, which is a high-usage command in Linux. The output information of the LS command can be colored highlighted to distinguish between different types of files.

Parameters:

The directory or file to display

Options :

-A: Show All files and directories

[Email protected] ppp]# ls-a.      Chap-secrets ip-down ip-up.ipv6to4 options peers. Eaptls-client ip-down.ipv6to4 ipv6-down options.pptpdbackup eaptls-server ip-up ipv6-up pap-sec RETs



-A: Displays except. and. List of all files except

[Email protected] ppp]# ls-abackup eaptls-server ip-up ipv6-up pap-secretschap-secrets ip-d Own ip-up.ipv6to4 options peerseaptls-client ip-down.ipv6to4 ipv6-down options.pptpd



-C: Default option, multi-column display

  -L: Displays a table of contents in a long format. The output information includes file name, file type, permission mode, number of hard connections, owner, group, file size, and last modified time of file, etc.

[[email protected] ppp]# ls -ltotal 52drwxr-xr-x. 2 root root    26 jun 21 13:02 backup-rw-r--r--.  1 root root  393  JUN 27 22:04 CHAP-SECRETS-RW-------.  1 root root  349 jan  26  2014 EAPTLS-CLIENT-RW-------.  1 root root  405 jan  26  2014 eaptls-server-rwxr-xr-x. 1 root root  386 sep  16  2015 ip-down-rwxr-xr-x. 1 root root 3214 Sep 16   2015 ip-down.ipv6to4-rwxr-xr-x. 1 root root  430 Sep 16   2015 ip-up-rwxr-xr-x. 1 root root 6426 Sep 16  2015  ip-up.ipv6to4-rwxr-xr-x. 1 root root 1687 sep 16  2015  Ipv6-down-rwxr-xr-x. 1 root roOt 3182 sep 16  2015 ipv6-up-rw-r--r--.  1 root root     5 jan 26  2014 options-rw-r--r--.  1 root root   174 JUN 21 13:07 OPTIONS.PPTPD-RW-------.  1 root root   77  Jan 26  2014 pap-secretsdrwxr-xr-x. 2 root root     6 sep 16  2015 peers



-F: Appends the type identifier to each output item, meaning: * Indicates a normal file with Execute permission/directory, @ denotes symbolic link, | Indicates that the pipe fifo,= represents a socket file; If the file is a normal file, the symbol is not displayed

[[email protected] ppp]# ls-fbackup/eaptls-server ip-up* ipv6-up* pap-secretschap-secrets IP -down* ip-up.ipv6to4* options peers/eaptls-client ip-down.ipv6to4* ipv6-down* options.pptpd



-B: Output non-output characters in the file as backslash \ Plus character encoding

  -C: When in use with the "-lt" option, the output is sorted according to the file status time, sorted by the CTime field of the index node of the file. When in conjunction with "-L", the order is based on the state change time of the file, (find recently modified file)

[[Email protected] ppp]# ls -clttotal 52-rw-r--r--.  1 root root   393 jun 27 22:04 chap-secrets-rw-r--r--.  1 root root  174  jun 21 13:07 options.pptpddrwxr-xr-x. 2 root root   26  JUN 21 13:02 BACKUP-RW-------.  1 root root   77 nov   9  2015 PAP-SECRETS-RW-------.  1 root root  349 nov   9  2015 EAPTLS-CLIENT-RW-------.  1 root root  405 nov   9  2015 eaptls-server-rw-r--r--.  1 root root     5 nov  9  2015 optionsdrwxr-xr-x. 2 root root     6 Nov  9  2015 peers-rwxr-xr-x. 1 root root 3182  Nov  9  2015 ipv6-up-rwxr-xr-x. 1 root root 1687 nov  9  2015  ipv6-down-rwxr-xr-x. 1 root root 3214 Nov  9  2015  ip-down.ipv6to4-rwxr-xr-x. 1 root root  430 nov  9  2015  ip-up-rwxr-xr-x. 1 root root 6426 Nov  9  2015  ip-up.ipv6to4-rwxr-xr-x. 1 root root  386 nov  9  2015  Ip-down


-D: Displays only the directory name, not the list of contents under the directory. Displays the symbolic link itself without displaying the list of directories it points to

[Email protected] ppp]# ls-d.



-F: Equivalent to-au, while closing the-lst parameter effect

-I: Displays the File node index number (inode). An index node represents a file

[[email protected] ppp]# ls-i33561426 backup 8752619 ip-down.ipv6to4 8875544 options 8875772 chap-secrets 8 752620 ip-up 8828786 options.pptpd 8875542 eaptls-client 8752621 ip-up.ipv6to4 8875545 pap-secrets 88755 Eaptls-server 8752622 Ipv6-down 17338787 peers 8752618 ip-down 8752623 ipv6-up



-K: Displays the file size in kilobytes

-M: Use to differentiate the name of each file and directory

[Email protected] ppp]# ls-mbackup, Chap-secrets, Eaptls-client, Eaptls-server, Ip-down, ip-down.ipv6to4,ip-up, Ip-up.ipv6to4, Ipv6-down, ipv6-up, Options, OPTIONS.PPTPD, pap-secrets,peers



-N: Replace its name with User ID and group ID

[[email protected] ppp]# ls -ntotal 52drwxr-xr-x. 2 0 0    26 jun 21 13:02 backup-rw-r--r--.  1 0 0  393 Jun  27 22:04 CHAP-SECRETS-RW-------.  1 0 0  349 Jan 26   2014 EAPTLS-CLIENT-RW-------.  1 0 0  405 Jan 26  2014  eaptls-server-rwxr-xr-x. 1 0 0  386 sep 16  2015  ip-down-rwxr-xr-x. 1 0 0 3214 sep 16  2015  ip-down.ipv6to4-rwxr-xr-x. 1 0 0  430 sep 16  2015  Ip-up-rwxr-xr-x. 1 0 0 6426 sep 16  2015 ip-up.ipv6to4-rwxr-xr-x.  1 0 0 1687 Sep 16  2015 ipv6-down-rwxr-xr-x. 1 0  0 3182 sep 16  2015 ipv6-up-rW-r--r--.  1 0 0    5 Jan 26  2014  Options-rw-r--r--.  1 0 0  174 Jun 21 13:07  OPTIONS.PPTPD-RW-------.  1 0 0   77 Jan 26  2014  pap-secretsdrwxr-xr-x. 2 0 0    6 sep 16  2015  Peers



-R: Order and output the list of directory contents in the reverse order of the file name

[Email protected] ppp]# ls-rpeers options ip-up.ipv6to4 ip-down chap-secretspap-secrets ipv6-up ip-up eaptls-server backupoptions.pptpd ipv6-down ip-down.ipv6to4 eaptls-client



-S: Displays the size of files and directories in chunks

[[email protected] ppp]# Ls-stotal 520 Backup 4 ip-down 4 ipv6-down 4 PAP-SECRETS4 chap-secrets 4    Ip-down.ipv6to4 4 ipv6-up 0 peers4 eaptls-client 4 ip-up 4 options4 eaptls-server 8 ip-up.ipv6to4 4 OPTIONS.PPTPD



-L: If you encounter a file or directory with a symbolic link, directly list the original file or directory that the link points to

-R: Recursive processing, displaying subdirectories and their contents

[[email protected] ppp]# ls-r.:backup eaptls-server ip-up ipv6-up pap-secretschap-secrets IP -down ip-up.ipv6to4 options peerseaptls-client ip-down.ipv6to4 ipv6-down options.pptpd./backup:opt Ions.pptpd./peers:



--full-time: List the full date and time

[[Email protected] ppp]# ls --full-timetotal 52drwxr-xr-x. 2 root root    26 2016-06-21 13:02:32.013269152 -0400 backup-rw-r--r--.  1  ROOT ROOT  393 2016-06-27 22:04:47.787080902 -0400 CHAP-SECRETS-RW-------.  1 root root  349 2014-01-26 17:03:34.000000000 -0500  EAPTLS-CLIENT-RW-------.  1 root root  405 2014-01-26 17:03:34.000000000  -0500 eaptls-server-rwxr-xr-x. 1 root root  386 2015-09-16  07:51:07.000000000 -0400 ip-down-rwxr-xr-x. 1 root root 3214 2015-09-16  07:51:07.000000000 -0400 ip-down.ipv6to4-rwxr-xr-x. 1 root root  430  2015-09-16 07:51:07.000000000 -0400 ip-up-rwxr-xr-x. 1 root root 6426  2015-09-16 07:51:07.000000000 -0400 ip-up.ipv6to4-rwxr-xr-x. 1 root root 1687 2015-09-16  07:51:07.000000000 -0400 ipv6-down-rwxr-xr-x. 1 root root 3182 2015-09-16  07:51:07.000000000 -0400 ipv6-up-rw-r--r--.  1 root root     5 2014-01-26 17:03:34.000000000 -0500 options-rw-r--r--.  1 root root   174 2016-06-21 13:07:36.576788032 -0400 OPTIONS.PPTPD-RW-------.  1 root  root   77 2014-01-26 17:03:34.000000000 -0500 pap-secretsdrwxr-xr-x.  2 root root    6 2015-09-16 07:59:43.000000000 -0400  Peers

--color[=when]: Highlighting different types of directories and files using different colors


Note: Command reference from man and Linux command Daquan website

This article is from the "Sleep under P" blog, so be sure to keep this source http://lch9978.blog.51cto.com/8159694/1795814

Linux Common Commands-ls

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.