Check total directory size from Ubuntu command line

On Ubuntu, you can easily view the total size of a directory or folder from the command line tools in the terminal. And the good thing is that you don’t need a special GUI app for this. This can be displayed with the du command. du is a short form of disk usage. This article explains how to check the size of a specific folder and all folders on your system from the Terminal application.

Linux Du command:

Find the specific folder size in the terminal.

The basic syntax is

du -hs /folderpath

-h: Human-readable number.
-s: summary only.
-c: Total
-h: human-numeric-sort
-r: reverse


du -hs /home/manikandan/Downloads

Where manikandan is my username that can be changed with the ubuntu username. The download folder size details are displayed.

Check total directory size from Ubuntu command line

Use this command if you want to get the size of a folder and everything else in that folder individually.

du -h /home/manikandan/Downloads

You can also sort by size using the sort options.

du -sch /home/manikandan/Downloads/* | sort -rh

Check total directory size from Ubuntu command line

Show all folders and file sizes:

Run this command to display the size of all folders and files system wide.Note: It scans and displays all files and folders from your system and takes some time to complete.


Other useful du command examples:

sudo du -h --max-depth=1 /var/lib
sudo du -sh --apparent-size /var/lib

If you like this article, please subscribe to us Youtube channel.. You can also stay connected with us twitter And Facebook..

READ: How to install qFSView on Ubuntu-Storage Visualization App
It’s a sequel.