HostOnNet Blog

Finding Disk Usage with du

du is a command line tool used to check disk space usage in a directory.

du -h -x --max-depth=1

-h will show directory size in human readable format, default is byte. You can use -k for size in KB.

-x Only show disk usage current file system, not mounted file system.


[root@ns3008246 /]# du -h -x --max-depth=1
0	./sys
7.2M	./bin
0	./proc
16K	./lost+found
4.0K	./srv
88K	./root
5.1M	./lib
36M	./etc
4.0K	./media
12M	./boot
4.0K	./home
359M	./var
25M	./sbin
604K	./tmp
4.0K	./opt
1.5G	./usr
4.0K	./mnt
4.0K	./selinux
0	./dev
23M	./lib64
1.9G	.
[root@ns3008246 /]# 

Show Disk Usage Sorted by size

du -k -x --max-depth=1 | sort -n

Posted in Linux