free disk and usage on Linux


Show disk tree or free and usage in the Linux Shell

Linux systems, like most operating systems, require enough free space on the system disk, which should not be full, otherwise important system services can no longer run, response times are skyrocketing and the system is stuck.

To determine used or unused Linux system resources without the presence of a graphical shell such as Gnome or KDE, the on-board medium and application of the Linux command-line tools are suitable. This guide shows useful commands like disk free usage tree for Bash in the Linux terminal to check the disk and memory usage.

Check disk usage by du

$ sudo du /var -Sh | sort -rh | head -5

This command line shows the top 5 allocation of disk usage (-s summarized) in the /var directory. This directory is important because the log files are located under /var/log, they grow over time, and always require sufficient free storage capacity.

$ du -hc --max-depth=0 ~/*

The home path displays the number of directories with size, the first level without subdirectories.

Check files size using find

$ sudo find /var -type f -exec du -Sh {} + | sort -rh | head -n 5

Here, find is used to output the 5 largest files under /var recursive with subdirectories.

If you have also installed tree (apt install tree), you can even create a directory tree with sizes (tree).

Create directory tree

$ sudo tree -ah /var/log -L 1

The size of the logs under /var/log is displayed in a human-readable output (-h) (-L 1 descending directory depth).

$ tree --du -d -shaC

Tree structure with:
–du, size
-d, directories only
-s bytes before name
-h, readable format
-a, hidden directory
-C, colorization

free disk tree and usage on Linux

dutree command-line tool

$ sudo dutree -s /home

Also, the command-line tool dutree, which can also be installed first, with yum install dutree.

dutree disk tree free linux
Illustration: dutree

Run dutree graphical output

dutree with graphical output from extended ASCII characters.

dutree disk tree free linux

dutree is additionally displayed in color with more contrast using lolcat there is also a post here.

The overall overview of the disk usage of the file system is displayed with the command-line tool df (disk free).

$ df -h

View disk space usage of the file system with df (disk free).

Show free memory

The memory load is determined and displayed with free.

$ free -h

Display the amount of free and used system memory, in the output is also displayed the use of swap memory.


It doesn’t always take a graphical interface like Gnome or KDE to determine the use of disk space and utilization by (du) disk usage. Anyway Linux servers are installed without an Xfce, Mate or Cinnamon desktop. The command-line tools like du, tree, find, df, free, or dutree are just as good, and fully fulfill the purpose. For this purpose, command-line utility in shell scripts can be used, which allows targeted status reports to be applied automatically.

disk tree dutree free linux

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

Your email address will not be published. Required fields are marked *