Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux basic command-du

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Du

Displays the disk usage of all directories, files, and subdirectories under the current directory in blocks. Summarize the disk usage of each file and recursively process the directory

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Du [options] [catalog]

2. List of options

Option

Description

-- help

Help

-- version

Display command version information

-a |-- all

Displays all file sizes, including directories, files, and subdirectories. The size of the file is not displayed by default

-- apparent-size

Print the apparent size, not disk usage; although the apparent size is usually small, it may be larger due to vulnerabilities in ("sparse") files, internal fragments, indirect blocks, and so on.

-B |-- block-size=SIZE

Set the block size for display

-b |-- bytes

Equivalent to "--apparent-size-- block-size=1"

-c |-- total

Generate a sum of statistics

-D |-- dereference-args |-H

Reference only symbolic links listed on the command line

-- files0-from=F

Summarizes the disk usage of the file name ending in NUL specified in file F; if F is "-", read the name from standard input

-h |-- human-readable

Display in a more readable way

-- si

Like "- h", except that the display unit is 1000 instead of 1024

-k

Equivalent to-block-size=1k

-m

Equivalent to-block-size=1M

-l |-- count-links

If it is a hard link, then the number of records

-L |-- dereference

Dereferencing all symbolic links

-P |-- no-dereference

Do not follow any symbolic links, which is the default

-0 |-- null

End each line of output with 0 bytes instead of newline characters

-S |-- separate-dirs

Does not include the size of subdirectories

-s |-- summarize

Only the total number of each parameter is displayed

-x |-- one-file-system

Skip directories on different file systems

-X |-- exclude-from=FILE

Exclude files that match any pattern in the file

-- exclude=PATTERN

Files that exclude matching patterns

-- max-depth=N

Print the total number of directories (or files) (or with-all) only if the number of directory layers is less than N; "--max-depth=0" is equivalent to "--summarize"

-- time

Displays the time of the last modification

-- time=WORD

Displays the time as the specified content instead of the modification time, which can be: atime, access, use, ctime, or status.

-- time-style=STYLE

Displays the time in the specified format, which can be full-iso,long-iso,iso,+FORMAT

The values displayed in this directive are in "--block-size", "DF_BLOCK_SIZE", "BLOCK_SIZE", and "BLOCKSIZE". This is the first of the four values available. Except for the first value that is set by the user, the other three are environment variables. If none of these four values are available, the default is 1024 (512 if POSIXLY_CORRECT is set).

The unit displayed may be: KB,1000;K,1024;MB,100*100;M,1024*1024.

3. Examples

1) View the total size of the home directory

[root@192 ~] # du / home-s

2320472 / home

2) use the "--time" option to display the last modification time

[root@192 ~] # du / home-- time

4 2010-11-12 08:54 / home/test01/.gnome2

4 2010-08-18 23:43 / home/test01/.mozilla/extensions

...

3) use the "- m" option to display in Mb

[root@192] # du / home-m

1 / home/test01/.gnome2 / / those less than 1m shall be treated as 1m

1/ home/test01/.mozilla/extensions

...

4) specify the display of "--time"

[root@localhost ~] # du / weijie/-- time=use / / Last use time

12 2018-10-08 09:11 / weijie/www.baidu.com

4 2018-10-08 09:11 / weijie/testftp

56 2018-10-13 08:40 / weijie/

[root@localhost] # du / weijie/-- time=status / / status change time

12 2018-10-03 10:09 / weijie/www.baidu.com

4 2018-10-02 09:34 / weijie/testftp

56 2018-10-03 10:09 / weijie/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report