Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the du command in linux to view the space

Shulou Source: shulou.com Published: 2022-06-02 19:47:27 11月23日 Update

Today, what the editor shares with you is to use the du command in linux to view the space. I believe many people don't know much about it. In order to make you understand better, I summarized the following contents for you. Let's look down together. I'm sure you'll get something.

The English full name of the du command is "Disk Usage", which is used to view the disk footprint. But unlike the df command, the du command is a view of the space used by file and directory disks, not a partition.

Syntax format: du [parameters] [file]

Commonly used parameters: coach

-a displays all file sizes in the directory-k displays file sizes in KB-m displays file sizes in MB-g displays file sizes in GB-h displays file sizes in an easy-to-read manner-s shows totals only

Reference example

Displays the size of the folder and subfolders in an easy-to-read manner:

[root@linuxcool] # du-h scf/

Displays all file sizes in the folder in an easy-to-read manner:

[root@linuxcool ~] # du-ah scf/

Output the space used by each subdirectory under the current directory:

[root@linuxcool] # du-hc-- max-depth=1 scf/

Displays the space occupied by the specified file:

[root@linuxcool ~] # du log2012.log about using the du command in linux to view the space is shared here. I hope the above content can be used as a reference for everyone. If you like this article, you might as well share it for more people to see.

Tags: File size space command unit folder method directory content parameter disk reference different knowledge for application value full name subdirectory subdirectory instance commonly used Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MariaDB Redmi Docker Apple