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

How to use the Linux du command

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "how to use the Linux du command". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use the Linux du command.

The Linux common command du command is used to display the size of a directory or file, and du displays the disk space occupied by the specified directory or file.

Syntax du [- abcDhHklmsSx] [- L] [- X] [--block-size] [--exclude=] [--max-depth=] [--help] [--version] [directory or file] parameter description:

-an or-all displays the size of individual files in the directory.

-b or-bytes displays the directory or file size in byte.

-c or-total displays not only the size of individual directories or files, but also the sum of all directories or files.

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

-h or-human-readable is in the unit of KMagazine G to improve the readability of the information.

The-H or-si parameters are the same as the-h parameters, but the conversion unit is 1000 for K _ Magne _ M _ G.

-k or-kilobytes is in units of 1024 bytes.

-l or-count-links repeats the hardware connection file.

-L or-dereference displays the source file size of the symbolic link specified in the option.

-m or-megabytes is measured in 1MB.

-s or-summarize displays only totals.

When-S or-separate-dirs displays the size of an individual directory, it does not include the size of its subdirectories.

-x or-one-file-xystem is based on the file system at the beginning of the processing, and will be skipped in case of other different file system directories.

-X or-exclude-from= is in the specified directory or file.

-exclude= skips the specified directory or file.

-ignore directories whose max-depth= exceeds the specified number of layers.

-help displays help.

-version displays version information.

Example 1: displays the space occupied by a directory or file

[root@tonyx home] # du 4. / tonyxu/.mozilla/plugins 4. / tonyxu/.mozilla/extensions 12. / tonyxu/.mozilla 4. / tonyxu/.gnome2 40. / tonyxu 44. Description: only show the size of the current home directory and subdirectories, the bottom 44 is the total count of the current directory example 2: show the space occupied by the specified files

[root@tonyx etc] # du inittab 4 inittab instance 3: view the space occupied by the specified directory

[root@tonyx home] # du tonyxu 4 tonyxu/.mozilla/plugins 4 tonyxu/.mozilla/extensions 12 tonyxu/.mozilla 4 tonyxu/.gnome2 40 tonyxu instance 4: display files and directories

[root@tonyx home] # du-ah tonyxu 4.0K tonyxu/.mozilla/plugins 4.0K tonyxu/.mozilla/extensions 12K tonyxu/.mozilla 4.0K tonyxu/.bash_history 4.0K tonyxu/.gnome2 4.0K tonyxu/.viminfo 4.0K tonyxu/.bash_profile 4.0K tonyxu/.bash_logout 4.0K tonyxu/.bashrc 40K tonyxu instance 5: display the disk space occupied by the two directories

[root@tonyx tmp] # du yum yum.bake 4 yum 8 yum.bake instance a file in the 6:var directory is too large, you can use the following command to view

[root@tonyx tonyxu] # du-s / var/* | sort-nr 468216 / var/cache 61260 / var/lib 1852 / var/log 1172 / var/www 160 / var/spool 148 / var/run 16 / var/tmp 16 / var/lock 8 / var/empty 8 / var/db 4 / var/yp 4 / var/preserve 4 / var/opt 4 / var/ Nis 4 / var/local 4 / var/gdm 4 / var/games 4 / var/crash 4 / var/account 0 / var/mail description: Sort-nr arranges backwards from big to small The files that take up the most disk space are first displayed and can be processed in a timely manner. Among the operation and maintenance, very important commands need to be kept in mind. I believe you have a deeper understanding of "how to use the Linux du command". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Development

Wechat

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

12
Report