Skip to content

[Linux] Use "du" command to check the file size

How to use du command

If you want to check a file or a directory in the Linux system, you can use du command to do it:

du "File"

In addition, if you want to control the displayed output unit, for example, input the initial size in GB, you can add parameter:

du --block-size=1G "File"

In this way, the final output unit is GB.

In addition, there are many commonly used parameters:

-a output file size
 -b display in bytes
 -c output individual file size, total
 -D output the source file size of the symbolic link
 -m uses MB as the display unit
 -s only output the sum
 -S When outputting the contents of the directory, the size of the subdirectory is not included
 --exclude ignore the specified file or directory
 --max-depth only search the specified directory depth

Tags:

Leave a ReplyCancel reply

Exit mobile version