Explanation of basic operation commands for folders in CentOS

Source: Internet
Author: User
Tags file size file system centos disk usage file permissions

Explanation of basic operation commands for folders in CentOS

ls--Display the contents of the specified directory

Description: LS displays results in different colors to distinguish file categories. Blue represents the directory, gray for ordinary files, green for executable files, red for compressed files, light blue for linked files.

-A---display all content, including hidden files

Description: In the Linux system, the "." The beginning is a hidden file or a hidden directory.

-L---Displays the details of a file or directory in long format (in more detail).

Description: Ls-l command can be shortened to LL,

The output information is divided into 7 groups:

File category and file permissions, number of links or subdirectories, file owner, file-owning group, file size (in bytes b), file creation or modification time, file name.

File Category: The first 1 digits represent the file category, "-" represents the normal file, "D" represents the directory, "L" represents the symbolic link, "C" for the character device, "B" for the Block device

File permissions: The first 9 digits represent file permissions, the first 3 are user, the middle 3 are group, and the latter three are other permissions

The-d---Displays the properties of the directory itself rather than the contents of the directory.

1 [root@localhost ~]# ls-ld/home

2 drwxr-xr-x. 4 root 4096 September 10:41/home

3 [root@localhost ~]# ls-d/home

4/home

5 [Root@localhost ~]#

-H---Display file size in K, M, G, etc. (Default is byte)

1 [root@localhost ~]# ls-h/home

2 Justin Lost+found

3 [root@localhost ~]# Ls-lh/home

4 Total Dosage 20K

5 drwx------. Justin Justin 4.0K September 13:19 Justin

6 drwx------. 2 root 16K September 15:30 lost+found

7 [Root@localhost ~]#

-R---If there are files in the directory, the files are listed in sequence

1 [root@localhost ~]# ls-lr/home

2/home:

3 Total Dosage 20

4 drwx------. Justin Justin 4096 September 13:19 Justin

5 drwx------. 2 root 16384 September 15:30 lost+found

6/home/justin:

7 Total Dosage 32

8 Drwxr-xr-x. 2 Justin Justin 4096 September 22 10:49 Public

9 drwxr-xr-x. 2 Justin Justin 4096 September 22 10:49 Template

Ten drwxr-xr-x. 2 Justin Justin 4096 September 22 10:49 Video

One by one drwxr-xr-x. 2 Justin Justin 4096 September 22 10:49 Pictures

Drwxr-xr-x. 2 Justin Justin 4096 September 22 10:49 documents

Drwxr-xr-x. 2 Justin Justin 4096 September 22 10:49 Download

Drwxr-xr-x. 2 Justin Justin 4096 September 22 10:49 Music

Drwxr-xr-x. 2 Justin Justin 4096 September 22 10:49 Desktop

16/home/justin/Public:

17 Total Dosage 0

18/home/justin/Template:

19 Total Dosage 0

20/home/justin/Video:

21 Total Dosage 0

22/home/justin/Pictures:

23 Total Dosage 0

24/home/justin/Documents:

25 Total Dosage 0

26/home/justin/Download:

27 Total Dosage 0

28/home/justin/Music:

29 Total Dosage 0

30/home/justin/Desktop:

31 Total Dosage 0

32/home/lost+found:

33 Total Dosage 0

[Root@localhost ~]#

-T---List files in order of establishment time

1 [root@localhost ~]# ls-l/home

2 Total dosage 20

3 drwx------. Justin Justin 4096 September 13:19 Justin

4 drwx------. 2 root 16384 September 15:30 lost+found

5-rw-r--r--. 1 root 0 September 15:21 t

6 [root@localhost ~]# ls-lt/home

7 Total Dosage 20

8-rw-r--r--. 1 root 0 September 15:21 t

9 drwx------. Justin Justin 4096 September 13:19 Justin

Ten drwx------. 2 root 16384 September 15:30 lost+found

One [root@localhost ~]#

Description: ls command can also be combined with the wildcard character "?" or "*" used together, the question mark "?" You can match any character in the file name, and "*" can match any number of characters in the file name. The two wildcard characters also apply to most other commands in the shell environment.

1 gssapi_mech.conf popt.d XML

2 gtk-2.0 Portreserve yp.conf

3 Hal Postfix Yum

4 host.conf PPP yum.conf

5 hosts Prelink.cache YUM.REPOS.D

6 Hosts.allow prelink.conf

7 Hosts.deny PRELINK.CONF.D

8 [root@localhost etc]# ll-d/ETC/PO*.D

9 drwxr-xr-x. 2 root root 4096 January 2010/ETC/POPT.D

[Root@localhost etc]# ll-d/etc/po? D

One LS: Unable to access/ETC/PO? D: no file or directory

[Root@localhost etc]#

Du---Display file or directory size

-H or--human-readable---to k,m,g to improve the readability of the information

1 [root@localhost src]# du-h nagios-3.5.0.tar.gz

2 1.8M nagios-3.5.0.tar.gz

3 [root@localhost src]# du nagios-3.5.0.tar.gz

4 1748 nagios-3.5.0.tar.gz

5 [Root@localhost src]#

-A---Show disk space for each file in all directories and Next Directory

-B or-bytes---Display the directory or file size, in bytes

1 [root@localhost local]# du-b src/nagios-3.5.0.tar.gz

2 1789376 src/nagios-3.5.0.tar.gz

3 [Root@localhost local]#

-C or--total---Displays the size of each directory or file, and also displays the sum of all directories or files

-M or--megabytes---in 1MB

-S---Show only the sum of each file size

1 [root@localhost local]# du-sh src/

2 41M src/

3 [Root@localhost local]#

-X---Only computes files of the same file system

-L---Calculate all file sizes

DF---Display the status of the file system; used primarily to understand the disk usage of individual file systems that are already mounted on the system

Related Article

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.