Do you want to find out how much free space is on your disk? If you are used to operating systems with a graphical user interface, such as Windows, this task is probably very simple. But what if you only come across a simple terminal? Do you need to install any tools? The answer is NO . In linux you can with just a few commands find out how much storage is being used on your disks and even folders without leaving your terminal.

df

This command is probably the simplest and will do most basic analysis. It has a wide variety of options but let's focus on the simpler reports: df -H. The option H means that you want the command to return in a read-friendly manner. The report will show, grouped by disks, how much space is available, used, free and the percentage used.

$df -H

But what if the number of discs is too large? As in the case of the image above, we have disks created by the Ubuntu snaps applications ( /dev/loopXY ) and we want to focus only on the main partition ( /dev/sda6 ):

$ df -H /dev/sda6

The result will now be limited to that disk:

du

Now that you know how to identify how much free space you have or not, it is very likely that you want to find out which folders and/or files are filling your computer's memory and that's where another very useful command comes in: O du (acronym for "disk usage" ). with the command du it is possible to identify how much each folder and file is using storage. Let's imagine our storage is running out and we want to know if the problem is in our downloads folder:

$ du -sh /home/shadowlik/Downloads

* We don't need to pass the full path to the command, we can only pass the path referring to the folder we are running in, in the case of the image above we could execute du -sh Downloads/ .

We saw above that the folder Downloads is weighing approximately 19 gigabytes, let's now find out what heavy files are in that folder and for that we'll pass the wildcard * for the command:

~$ du -sh Downloads/*
Screenshots are different because I formatted my computer while finishing this article.
* File names have been erased for safety.

Now you know how to identify how much storage space you have left and how to find places that may be overloading your disk. learn too how to find out the linux version and distribution and also the create a sudo user !

0 0 votos
Nota do Artigo
Subscribe
Notify of
guest

0 Comentários
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x