How to view Linux Space free and Usage

0
(0)

View disk space 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 for Bash in the Linux terminal to check the disk and memory usage.

Check disk usage using du

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.

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

Check files size using find

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 using tree

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

Tree

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

dutree command-line tool

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

dutree
Illustration: dutree

dutree with graphical output from extended ASCII characters.

dutree-s

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).

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

View memory with free

The memory load is determined and displayed with free.

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

Conclusion

It doesn’t always take a graphical interface like Gnome or KDE to determine the use of disk space and utilization, 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.

Tree

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

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 *