Centos command for viewing the size of a single file

Source: Internet
Author: User

Run the "du-h abc.tar" command to resize the abc.tar file in the current directory.
Run the "du-sh centoscn" command to view the entire folder size in the centoscn directory.

Ps: Syntax: du [-abcDhHklmsSx] [-L <symbol connection>] [-X <File>] [-- block-size] [-- exclude = <directory or File>] [-- max- depth = <directory layers>] [-- help] [-- version] [directory or file] common parameters: -a or-all shows the disk usage for each specified file, or shows the disk usage for each file in the directory. -B or-bytes: displays the size of directories or files in bytes. -C or-total not only displays the directory or file size, but also the total number of all directories or files. -D or-dereference-args displays the size of the source file connected by the specified symbol. The unit of-h or-human-readable is K, M, and G, which improves information readability. The-H or-si parameters are the same as the-h parameters, but K, M, and G are in units of 1000, rather than 1024. -K or-kilobytes is in the unit of 1024 bytes. -L or-count-links repeat the hardware connection file. -L <symbol connection> or-dereference <symbol connection> shows the size of the source file for the specified symbol connection. -M or-megabytes is in the unit of 1 MB. -S or-summarize only displays the total, that is, the size of the current directory. -S or-separate-dirs displays the size of each directory in hours without the size of its subdirectories. -X or-one-file-xystem is based on the file system at the beginning of processing. If it encounters a different file system directory, it is skipped. -X <File> or-exclude-from = <File> specifies the directory or file in <File>. -Exclude = <directory or File> skips the specified directory or file. -Max-depth = <directory layers> if the number of directories exceeds the specified number of directories, ignore the directory. -Help: displays help. -Version: displays the version information. Example of using the du command in linux: 1> to display the disk usage of a directory tree and each subtree du/home/linux, the number of disk blocks is displayed in the/home/linux directory and each subdirectory. 2> to display the disk usage of a directory tree and its sub-trees in 1024 bytes, du-k/home/linux is displayed in the/home/linux directory and each of its sub-directories. the disk size is 1024 bytes. 3> the disk usage of a directory tree and its sub-trees is displayed in MB. du-m/home/linux shows the MB disk in the/home/linux directory and each sub-directory. number of blocks. 4> display the disk usage of a directory tree and its sub-trees in GB. du-g/home/linux shows the GB disk in the/home/linux directory and its sub-directories. number of blocks. 5> View the size of all directories and subdirectories in the current directory: du-h. "." indicates the current directory. You can also use a clear path-h to display the user directory in the form of K, M, and G. 6> View the size of the user directory in the current directory, rather than viewing other directories and Their subdirectories: du-sh user-s indicates the meaning of the summary, that is, to list only one summary value du-h-max-depth = 0 user-max-depth = n indicates that only the directory at the nth layer is penetrated. Here, the value is set to 0, that is, the sub-directory is not penetrated. 7> list the sizes of all directories and files in the user directory and Its subdirectories: du-ah user-a indicates that the directory name in the current directory does not include the directory size of the xyz string, including the Directory and file 8>: du-h-exclude = '* xyz *' 9> to list more information about the user directory and subdirectory size on one screen: du-0 h user-0 (zero bars) indicates that the information of each directory is listed. Instead of line feed, the information of the next directory is directly output. 10> only display all disk usage of one directory tree du-s/home/linux
 

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.