The LS command of Linux command and the explanation of common parameters

Source: Internet
Author: User

1. ls command explanation

LS English is all called list, listing the meaning. The role is to list the contents of the directory

2. command format

Ls [ parameters ] [ Table of Contents ]

3. Command Common parameters

Without parameters: Lists all filenames under the directory by default

-L: list details of directories and files (note,ll equals ls–l)

-A: list Everything under the directory, including Hidden

- T sort by last modified time

- S sort by file size. (S in uppercase )

- R sort in reverse order.

4. Command Instances

Instance one: default without parameters

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6D/42/wKiom1VfEKfjb-T-AAA2LOelW9Q192.jpg "style=" float: none; "title=" 360 desktop 20150522191839.jpg "alt=" Wkiom1vfekfjb-t-aaa2loelw9q192.jpg "/>

where blue old is the directory, the other two files. Visible, in case the LS command lists all subdirectories and filenames under the current directory

Example two:-l parameter

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6D/3E/wKioL1VfEjHRGeEaAAEADRmAiWo811.jpg "title=" 360 Desktop 20150522191851.jpg "style=" Float:none; "alt=" wkiol1vfejhrgeeaaaeadrmaiwo811.jpg "/>

the-l parameter lists details of subdirectories and files in this directory

The following is an example of an old directory explaining the meaning of listing information

Drwxr-xr-x where d denotes old as the directory, and if - represents the file, next indicates that the owner-owned permission to change the directory is rwx, that is, read-write execution. The permissions of the group belonging to the master are r-x and can be read and executable. The permissions for other users are R-x.

2 indicates the number of links to the directory

Rootroot represents the owner and user group of the directory old

4096 indicates the size occupied by the directory old in bytes

May22 09:29 Indicates when the directory was created or modified

Old directory name

example Three:-a parameter

First Look at what happens when the-a parameter is not used

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6D/3E/wKioL1VfEbTx_SJ9AACXbhEGxwo846.jpg "style=" float: none; "title=" 360 desktop 20150522191618.jpg "alt=" Wkiol1vfebtx_sj9aacxbhegxwo846.jpg "/>


use the-a parameter 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M00/6D/3E/ Wkiol1vfebtwixwhaaeccg4j-9a472.jpg "title=" 360 desktop 20150522191640.jpg "style=" Float:none; "alt=" Wkiol1vfebtwixwhaaeccg4j-9a472.jpg "/>

except for the top The file also lists hidden files, including . and .. these two files

example four: -S parameter, sorted by file size.

First Use ls–l to see the original sort and size


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6D/42/wKiom1VfD8bxYKwdAAG0PUA2jkA523.jpg "style=" float: none; "title=" 360 desktop 20150522191416.jpg "alt=" Wkiom1vfd8bxykwdaag0pua2jka523.jpg "/>

It can be seen that the sort follows the character order of the file, in the case of using -S:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6D/3E/wKioL1VfEVCjzxIeAAHKXQPConE546.jpg "title=" 360 Desktop 20150522191403.jpg "style=" Float:none; "alt=" wkiol1vfevcjzxieaahkxqpcone546.jpg "/>


Sort by file size (fifth list file size)


This article is from the "Luohaizi" blog, make sure to keep this source http://597881426.blog.51cto.com/6819945/1654035

The LS command of Linux command and the explanation of common parameters

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.