On Unix-like operating systems, the du command estimates and displays the disk space used by files.
This page covers the GNU/Linux version of du.
Syntax
du [OPTION]… [FILE]…
du [OPTION]… –files0-from=F
Options
SIZE format
Display values are in units of the first available SIZE from –block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables. Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
- Syntax
- Options
- SIZE format
- Examples
- Related commands
- Linux commands help
SIZE is an integer and optional unit (example: 10M is 1010241024). Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, … (powers of 1000).
Examples
du -s *.txt
Reports the size of each file in the current directory with the extension .txt. Below is an example of the output:
8 file1.txt 8 file2.txt 10 file3.txt 2 file4.txt 8 file5.txt 8 file6.txt
du -shc *.txt
Display the same data, but in a “human-readable” size format, and display a grand total.
8.0K file1.txt 8.0K file2.txt 10.0K file3.txt 2.0K file4.txt 8.0K file5.txt 8.0K file6.txt 44.0K total
Related commands
df — Report the amount of available disk space on file systems.ls — List the contents of a directory or directories.