Linux disk management command-fdformat

Source: Internet
Author: User
Tags disk usage
From: http://fanqiang.chinaunix.net/a1/b5/20010508/132803.html

The original English meaning of DU is "disk usage", which means to display the usage of disk space.

Function: calculates the disk space occupied by directories (or files.

Syntax: Du [Option] [names…]

Note: This command step by step enters each sub-directory of the specified directory and displays the directory's usage of File System data blocks (1024 bytes. If no names is provided, the current directory is counted.

The options of this command are as follows:

-S indicates the total number of data blocks occupied by each names parameter.

-A Recursively displays the number of data blocks occupied by each file in the specified directory and its descendants. If neither-s nor-A is specified, only the disk blocks occupied by each directory and Its subdirectories in names are displayed.

-B lists disk space usage in bytes (the system defaults to K bytes ).

-K lists the disk space usage in 1024 bytes.

-C is followed by a total (system default setting ).

-L calculate the size of all files, and calculate hard-linked files multiple times.

-X skipping directories on different file systems is not counted.

The following is an example of the use of the du command:

Example 1: view the disk space occupied by the/mnt directory. $ CD/mnt $ LS-LFR total 10-rwxrwxrwx 2 root Root ll0 ju1 3l 00:33 AA *

Drwxr-XR-x 2 root Root l024 ju1 20 14:16 DEV/

-RW-r -- 1 Root 6229 Aug 2 0l: 39 s1ack

Drwxrwxrwx 2 root Root 1024 Aug 2 02: 09 var/

1 rwxrwxrwx 1 Root l0 Aug 2 0l: 51 Wei->/home/Wei/

Dev:

Tota1 0

Lrwxrwxrwx 1 Root 8 ju1 20 L4: L6 CDROM->/dev/HDB

VaR:

Tata1 37

-R-XR-x L Root 36064 Aug 2 rawrite. EXE *

Example 2: List the disk space occupied by each directory, but not the space occupied by each file.

$ Du

L./dev

38./var

48.

The first column in the output list is the disk space capacity measured in blocks, and the second column lists the directory names that use these spaces.

Note that the "du" command without options will run down the directory structure from the current directory until the capacity of all directories is listed. This may be a very long list, and sometimes only one total number is required. In this case, you can add the-s option in the du command to obtain the total number:

$ Du-S/mnt

/Mnt

Example 3: List the space occupied by all files and directories (using option A), and calculate the size in bytes (using option B.

$ Du-AB

8./dev/CDROM

L032./dev

36064./var/rawrite. exe

37088./var

6229./s1ack

1l0./AA

L0./Wei

45493.
 

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.