Linux ls detailed explanation __linux

Source: Internet
Author: User
Tags parent directory

The LS command means that the list displays the name of the file in the current directory. Note that without arguments it displays all files and directories except hidden files. LS is a frequently used command in Linux/ubuntu and is also a very basic command.

1, the meaning of the color of the file name

1) The default color represents the normal file. Example: Install.log

2) green represents the executable file. Example: Rc.news

3) Red represents the tar package file. Example: vim-7.1.tar.bz2

4) Blue represents the directory file. Example: AA

5) Shuihong represents the image file. Example: sunset.jpg

6) Cyan represents the linked file. Example: rc4.d (this type of file is equivalent to a shortcut)

7) Yellow represents the device file. Example: fd0

2, ls command

1) ls–a (All): Indicates that all files are listed, including the "." The hidden file at the beginning. At the beginning of this list. And. In turn, the parent directory and your current directory.

2) Ls–l (long): Enumerates the details of the contents of the directory, including permissions (schema), owner, group, size, date created, whether the file is a link to other parts of the system, and the link's point.

# ls–l

Total 5

-rw-r--r--1 root root 1668 Oct 3 2007 anaconda-ks.cfg

Drwxr-xr-x 2 root root 4096 Nov 6 00:04 AA

*total 5: The total size of the file on behalf of the current directory is 5K (the size of each directory is 4K)

*drwxr-xr-x the first character has 3 cases: "-" for normal files, "D" for Directories, "L" for connection files, and "B" for device files. The following 9 characters are set for each 3, representing the owner of the file, the group of users who owns the file, and the permissions that other users have on the file. Each of the 3 characters in each group represents read, write, and Execute permissions, or "-" if they do not have any of these permissions. The executed permission has two characters optional "x" to represent the executable, "s" represents the set interface file.

* The following number 2 represents the number of directory files in the directory "AA" (This number = the number of hidden directories + the number of normal directories). If this AA is a normal file, 2 represents the file with 2 aliases (this file was created by a hard link file)

* The next root represents the owner of this file (directory) as: User root

* Then the next root represents the user group that this file (directory) belongs to: group Root

* 4096 represents the size of the file (in bytes), and the directory is always 4096 bytes in size.

* Nov 6 00:04 represents the modified time of the file (directory).

*AA represents the name of the file (directory).

3 Ls–hl-H: Increases readability when displaying file size

3, other parameters detailed

1-D: If followed by a directory, this output only the name of the directory

2-T: Indicates that the listed entries are sorted by the last modified time, by default, by using the name of the folder

3)-C: Sort the column vertically by the name of the file

4)-R reverse (reverse): Enumerates the contents of the directory from the post forward.

5-R Recursive (recursive): This option recursively enumerates the contents of all directories (under the current directory).

6-S size: sorted by file size.

7-F File type: Adds a symbol after each enumeration item. These symbols include:/indicate a directory; @ indicates a symbolic link to another file; * indicates an executable file.


Reprint Address: http://blog.lehu.shu.edu.cn/byman/A293366.html

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.