How to check directory size in linux

From Cyberlaw: Difficult Issues Winter 2010
Revision as of 11:29, 17 May 2022 by <bdi>192.168.10.74</bdi> (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Find directory size with du -sh command in Linux The best Linux command to check directory size is using du -sh command. Open the terminal and type du -sh directory name in the prompt. The directory size will be listed on the first column. The size will be displayed in Human Readable Format. This means we can see directory sizes in Bytes, Kilobytes, Megabytes, Gigabytes, etc.

  • -s, –summarize : display only a total size
  • -h, –human-readable : print sizes in human readable format (e.g., 1K 234M 2G)


For example, the following command will check the size of the /etc directory: $ du -sh /etc. The output of this command will be something like this: 18M /etc


If we need to check the size of files and sub-directory under /etc/, we can use du -sh /etc/*.


5 ways to check directory size in Linux