Linux: Find Out Directory Size Command



To get the size of a Directory in Linux, use du command. du command is used to find the file space usage & summarize disk usage of each file/directory.

To find the size of /usr directory:

  du /usr
OR

 Pass -s option to see the total disk space summary & -h option for human readable format.

  du -sh /usr


We can also list the contents of the directory (whether file or directory) with size:-

du -sh /usr/*

Sample output:
[[email protected] ~]# du -sh /usr/*
71M     /usr/bin
8.0K    /usr/etc
8.0K    /usr/games
87M     /usr/include
122M    /usr/java
1.8M    /usr/kerberos
535M    /usr/lib
199M    /usr/lib64
12M     /usr/libexec
212M    /usr/local
17M     /usr/sbin
563M    /usr/share
57M     /usr/src
4.0K    /usr/tmp
48M     /usr/X11R6




0 comments:

Post a Comment