Important commands to find size of the files and folders in linux

Some useful commands to find size of the files and folders in linux

1. To find the size of all partitions in the linux system

df -kh
To find the size of all partitions in the linux system

2. To find the total size of the folder

du -sh 
To find the total size of the folder

3. To find the largest files or folders from the selected folder

du -sh -- * | sort -hr
du -sh -- * | sort -hr  | head -n 10
du -sh -- /var/log/* | sort -hr  | head -n 10
To find the largest files or folders from the selected folder

4. To find the total size by excluding specific folder or patterns

du -csh /var/log/* --exclude=/var/log/journal | sort -hr  | head -n 10
To find the total size by excluding specific folder

1 Comment

Add a Comment
  1. Nice post. I learn something totally new and challenging on sites I stumbleupon every day. It will always be interesting to read content from other writers and practice something from their websites. Neile Richy Millham

Leave a Reply