du command
LINUX-Frequently used commands
du command Check and display usage by directory. |
Syntax |
du [Option] [directory] |
The du command is used to check the disk usage status. It displays the usage of the specified file or directory in blocks (one block is one kilobyte). If no argument is specified, the information under the current directory will be displayed.. |
Frequently used options |
-a Display the capacity of files in the directory as well -s Display the total size including subdirectories -s Display the total size without including subdirectories -b Display the capacity in bytes -k Display capacity in kilobytes |
Example: Displays the disk usage of subdirectories under the specified directory without options. |
$ du /usr/share 84 /usr/share/groff/1.18.1.4/font/devX100 20 /usr/share/groff/1.18.1.4/font/devlj4/generate 464 /usr/share/groff/1.18.1.4/font/devlj4 24 /usr/share/groff/1.18.1.4/font/devascii 84 /usr/share/groff/1.18.1.4/font/devX75 88 /usr/share/groff/1.18.1.4/font/devhtml 84 /usr/share/groff/1.18.1.4/font/devX75-12 24 /usr/share/groff/1.18.1.4/font/devascii8 24 /usr/share/groff/1.18.1.4/font/devlatin1 32 /usr/share/groff/1.18.1.4/font/devnippon … abbreviation … 20 /usr/share/tabset 316980 /usr/share/ |
Example: Displays disk usage for files as well as directories |
$ du -a /usr/share/ 4 /usr/share/groff/1.18.1.4/font/devX100/TR 4 /usr/share/groff/1.18.1.4/font/devX100/HB 4 /usr/share/groff/1.18.1.4/font/devX100/HBI 4 /usr/share/groff/1.18.1.4/font/devX100/CI 4 /usr/share/groff/1.18.1.4/font/devX100/NBI 4 /usr/share/groff/1.18.1.4/font/devX100/CB 4 /usr/share/groff/1.18.1.4/font/devX100/NI 4 /usr/share/groff/1.18.1.4/font/devX100/NR 4 /usr/share/groff/1.18.1.4/font/devX100/S 4 /usr/share/groff/1.18.1.4/font/devX100/DESC 4 /usr/share/groff/1.18.1.4/font/devX100/TB 4 /usr/share/groff/1.18.1.4/font/devX100/HR … abbreviation … 20 /usr/share/tabset 316980 /usr/share/ |
Example: Disk space is displayed with units for easy reading. |
$ du -h /usr/share/ 84K /usr/share/groff/1.18.1.4/font/devX100 20K /usr/share/groff/1.18.1.4/font/devlj4/generate 464K /usr/share/groff/1.18.1.4/font/devlj4 24K /usr/share/groff/1.18.1.4/font/devascii 84K /usr/share/groff/1.18.1.4/font/devX75 88K /usr/share/groff/1.18.1.4/font/devhtml 84K /usr/share/groff/1.18.1.4/font/devX75-12 24K /usr/share/groff/1.18.1.4/font/devascii8 24K /usr/share/groff/1.18.1.4/font/devlatin1 32K /usr/share/groff/1.18.1.4/font/devnippon 84K /usr/share/groff/1.18.1.4/font/devX100-12 … abbreviation … 20K /usr/share/tabset 310M /usr/share/ |
Example: Displays only the disk usage of the specified directory. |
$ du -s /home/koro 364100 /home/koro $ du -sh /home/koro 356M /home/koro |