Ways and more ways to free up space in Ubuntu

ccleaner ubuntu

Linux-based operating systems, such as Ubuntu, lack pre-installed tools to free up space garbage and unnecessary files on our hard drive. While Windows has its own defragmenter and space cleaner, in Linux there are several commands that, luckily, will help us make this task much lighter.

The following article shows several ways to free up space in Ubuntu to take advantage of that good, sometimes so scarce, that is the storage in the hard disk.

If your disk has been gradually filling up with garbage and useless files, do not despair, with this guide you will learn some very useful tricks to take advantage of all the space on your hard disk.

Uninstall apps and games that you no longer use

The most obvious and simple of all, and the one we worry about least most of the time, is gradually eliminate those programs or games that we no longer use. Maybe you had planned to use them later or were keeping them out of simple nostalgia, but they take up valuable space on your hard drive that you can take advantage of.

There is no reason to keep several browsers on the computer at the same time (Chromium, Opera, Firefox, ...), several email managers (Thunderbird, Claws, Evolution, ...) or countless programs that perform a similar function but of the that we only employ a few. And the same goes for games. Get rid of the ones you don't use and you'll regain more space on your drive than you bargained for. To do this, just use the following command:

sudo apt remove paquete1 paquete2 paquete3

And see the results with:

df -h

If you also want remove those packages or dependencies that are no longer needed within the system, you can use the following command:

sudo apt autoremove

Compress your data

Although it is important to always have our data available, you may want to save some space by compressing those files that you have not used for a while. They will continue to be equally accessible within the system, although not in such a direct way, and in return you will gain some storage space. As the period we determine to compress may vary, we leave you an example for files whose value is greater than 30 days (-mtime parameter), which you can modify to your liking:

find . -type f -name "*" -mtime +30 -print -exec gzip {} \;

Clear the APT cache

Maybe you had not fallen into it, but the application apt caches a lot of information regarding the updates of each package that is installed within the system. Get out of doubts and check in your system how much space is being wasted on your computer with the following command:

du -sh /var/cache/apt/archives

If you are one of the users who like to test applications and you spend the day installing, reconfiguring and uninstalling programs, you can get rid of all that useless information which is cached apt with the following command:

sudo apt clean

With this function all cached packages will be removed from Ubuntu. apt regardless of its age. Nevertheless, if you have a slow internet connection, you should consider which factor benefits you the most, your hard drive space or download time.

Update your system frequently

Although it might sound confusing, on many occasions package updates manage to optimize space resources and occupy a smaller size within the team. Therefore, check frequently for package updates and do not hesitate to use the command upgrade of your apt-get.

Use a system cleaner

They exist, as you will already suppose, third party programs that allow in a more or less effective way perform a general cleaning of your entire system. One of them is BleachBit, and given its specialty, it can carry out a general cleaning task in a few minutes.

supports up to 70 of the most popular applications Linux environment (browsers, email managers, bash history, etc.) and is capable of remove duplicate files from the system or those with an age that we indicate, so it can be an alternative to consider. However, be cautious when using these types of tools, as we lose much of control over what they do and they can ruin our system or information if we do not handle it carefully.

bleachbit

Delete the kernel files you don't use

Finally, and somewhat further from the conventional sphere, is the deletion of those files kernel that we do not use in the system. We have reserved it for the end because it is the most extreme of all but, if you are sure that you do not use any other kernel within the system, why store its files. Eliminate them with this command and free some megabytes of your team:

sudo apt autoremove --purge

Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   bronco said

    Another may be to use tune2fs to reduce the disk space reserved for the system, by default it is 5% but it can be reduced to 2 or 3% in the system partitions (if we have a disk like those of today with a large capacity ) and 0% on data partitions.

  2.   Ruben said

    I do not recommend Bleachbit, I already had problems once and I will not play it again.

  3.   elwachingamer said

    lol i thought bleachbit was saying bleachbitch
    xD

  4.   laugh said

    Interesting, thanks. In my case, with Linux Mint MATE, the command that has freed up the most space (several gigabytes) has been this:
    sudo flatpak repair