Home Linux Did you run out of space on the Linux machine? Delete the “big” files

banneraliexp

Did you run out of space on the Linux machine? Delete the “big” files

by ace
Did you run out of space on the Linux machine? Delete the “big” files

With regard to storage systems, if you look at the machines that are sold, the (storage) space is getting smaller. This is because the brands equip their machines with SSD drives, thus betting on performance.

If you receive an alert that you are out of space on your machine, find out what you can do on Linux.

GNU / Linux systems have the most diverse types of tools available. Also, don't forget that Linux distributions also have a powerful shell. With regard to storage, for those who need to free up some disk space, here are some tips. The tips we present are based on the du and find commands.

How to discover large files and directories on Linux?

Let's assume you want to know which are the largest files and subdirectories in the / home directory. To do this, just use the following command:

du -a / home | sort -n -r | head -n 5

Did you run out of space on the Linux machine? Delete the files

To know only which directories have more information, from the current directory, just use the command

du -a | sort -n -r | head -n 5

The format of the presentation of the result can also be adapted. To see the output with the respective size in KB, MB, GB just use the command:

du -hs * | sort -rh | head -5

Did you run out of space on the Linux machine? Delete the files

Finally, if you want a command to view only the largest files, just use the command:

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

And these are our tips for today. Obviously, there are graphical tools that do this job. We will present some of these tools in an upcoming article. If you have suggestions please leave them in the comments.

bannerebay

Related Articles

Leave a Comment

four × 2 =

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More