Linux du command

1. Concept

       The du command is used to display the size of a directory or file.

2. Grammar

       du parameter file/directory

   1. Parameter description

          -a or -all: Display the size of individual files in the directory.

          -b or -bytes: When displaying the directory or file size, use bytes as the unit.

         -c or --total: In addition to displaying the size of individual directories or files, it also displays the sum of all directories or files.

         -D or --dereference-args: Display the source file size of the specified symbolic link.

        -h or --human-readable: Take K, M, G as the unit to improve the readability of information.

        -H or --si is the same as -h parameter, but K, M, G are conversion units of 1000.

       -k or --kilobytes: Use 1024 bytes as the unit.

      -l or --count-links: repeatedly count the files connected by the hardware.

      -L<symbolic link> or --dereference<symbolic link>: Display the source file size of the symbolic link specified in the options.

      -m or --megabytes: in units of 1MB.

      -s or --summarize: display only the total.

     -S or --separate-dirs: When displaying the size of individual directories, the size of its subdirectories is not included.

     -x or --one-file-xystem: Take the file system at the beginning of the process as the standard, and skip it if it encounters a different file system directory.

     -X<file> or --exclude-from=<file> "Specify a directory or file in <file>.

     --exclude=<directory or file>: Skip the specified directory or file.

     --max-depth=<number of directory levels>: After the directory exceeds the specified number of levels, it will be ignored.

     --help: Show help.

    --version: Display version information.

Three, example

  1. Display the space occupied by a directory or file: du

2. Display the size of the specified directory or file: du apollo/ or du images/test/1442823267906.jpeg

 3. Display the size of the current directory: du -sh

 4. Display the size of all files in the current directory: du -sh *

 

Commonly used command: du -sh *, Scenario: Used to view the size of the disk file, and delete those files that take up a lot when the disk is full

Guess you like

Origin blog.csdn.net/baidu_28068985/article/details/107914387