• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Get Directory Size

September 7, 2019

Here’s how to get the size of a directory.

du -sh /var/www

du -sh /var/www

Output:

2.1GB    /var/www

2.1GB /var/www

Size of the directories and files one level down.

du -sh /var/www/*

du -sh /var/www/*

Sort with biggest files from top to bottom.

du -sh /var/www/* | sort -rh

du -sh /var/www/* | sort -rh

Top 5 biggest files from top to bottom.

du -sh /var/www/* | sort -rh | head -5

du -sh /var/www/* | sort -rh | head -5

Filed Under: Linux Tagged With: directory, linux, size

Search This Website

Subscribe Via Email

  • Home
  • About
  • Archives

Copyright © 2023