4 Simple Steps to Clean Your Ubuntu System

3 min


4 simple steps which you can try right now to clean up your Ubuntu installation.

This quick tutorial would help you to clean up old Ubuntu installations and free up some disk space. If you are running an Ubuntu system for more than a year, you might feel that your system is slow, lagging despite you are up-to-date. Over time, there are many apps which you might have installed just to experiment, or after reading a great review but you did not remove them. These are some ways that can help you find out some hidden disk spaces which you can free up.

Steps to Clean Your Ubuntu System

1. Clean Apt Cache

An apt cache is a place where Ubuntu keeps all the files that you have downloaded just in case you need to refer them at a later time. Most of the users don’t bother to clean this up and may take up hundreds of MBs.

Open a terminal and run below to command to see how much your cache size is:

du -sh /var/cache/apt/archives

You would be surprised to see the size if yours is an old installation. Run below from the terminal to clean it up.

sudo apt-get clean

2. Remove unused Kernels

If you are running an Ubuntu system/installation for more than a year, chances are high that you are having multiple Kernels installed. If your hardware is the latest and compatible with Linux without much configuration, you may go ahead and remove old Kernels keeping the latest one. Run below from the terminal to clean those up:

sudo apt-get autoremove --purge
Autoremove Purge
Autoremove Purge

3. Remove Old Apps, Packages

If you are a person who likes to experiment with Linux Apps, you surely have some unused apps in your system which you definitely do not need anymore.

Now, you may have forgotten about the app names which you have installed. You can run below from the terminal to find out what you have recently installed:

SEE ALSO:   How to Install and Use GNOME Shell Extensions in Ubuntu

This will give you a list of apps, packages you have installed via apt command:

history | grep "apt-get install"
List of apt installed app - History
List of apt installed app – History

This will give you a list of apps which you have installed in recent pasts:

grep " install " /var/log/dpkg.log.1
zgrep " install " /var/log/dpkg.log.2.gz

You can run the below commands to remove the apps, packages:

sudo apt remove   app1 package1

4. Use a system cleaner app

There is plenty of free and native system cleaner app is available, however, I feel BleachBit is the best and oldest app for this purpose.

Install BleachBit using the below command or install using Software.

sudo apt install bleachbit

Once installed, open BleachBit and run a scan. It would show you all the cache files your browser is taking up, temp files, trash, etc and with a click of a button you can clean it up.

Bonus Tip

You can also search for files with large size manually using the following command.

find /home -type f -exec du -h {} + | sort -hr | head -20

For example, following command searches and gives you first 20 large files in root directory “/”. Now you can review the large files and manually remove it usign file manager. Be carefull while deleting any file. Try not to touch anything other than in your /home directory.

Find Large files in Linux
Find Large files in Linux

So, that’s it. If you followed the above steps, you definitely freed up some space in your Ubuntu system and your system can breathe now. These are some of the steps which you can follow to clean your Ubuntu system. Do not forget to keep your system up-to-date with the latest packages.

Comment below if you think you are able to free up some disk space and make your Ubuntu faster using these tips. What command you normally use to Clean Your Ubuntu System? Let me know.


We bring the latest tech, software news and stuff that matters. Stay in touch via Telegram, Twitter, YouTube, and Facebook and never miss an update!

Join our Telegram channel and stay informed on the move.

Also Read


Like it? Share with your friends!

Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
1
0
Would love your thoughts, please comment.x
()
x