In Ubuntu there are several ways available to clean and free up hard drive space without any 3rd party tools. cleaning the disk space is useful for small size hard drive and ssd users. Please follow the below tips to clean and free up Ubuntu system by removing the unwanted junk files from your hard drive.
1. Uninstall Unnecessary Applications From Ubuntu
Always remove unused applications from your Ubuntu system to save some space. You can remove a application or software from the Ubuntu software. If you know the exact package name, you can also remove it from terminal.
sudo apt remove packagename
You can replace the packagename with the exact name.
Example: If you want to uninstall htop from your system, then run below command.
sudo apt remove htop
2. Remove unwanted or required no longer packages in Ubuntu
Use the below command in terminal to remove any orphaned package from your Ubuntu system. Orphaned packages are installed as a dependencies of your main program. If that main program is removed, these orphaned packages are useless in the system.
sudo apt autoremove
3. Remove APT cache in Ubuntu
You can free up APT cache in ubuntu to save some disk space. By default APT keeps a cache of previously downloaded and installed packages even after they’ve been uninstalled. Run the below code in terminal to clean all APT caches.
sudo apt clean
or you can just remove the outdated package cache by running the below command in terminal.
sudo apt autoclean
To check the cache size use the below command.
sudo du -sh /var/cache/apt
4.Remove thumbnail cache in Ubuntu
Removing the thumbnail cache also increase the disk space in Ubuntu. Ubuntu automatically creates the a thumbnail, if you open or view any file. To check the cache size, run the below command in terminal.
du -sh ~/.cache/thumbnails
To delete the thumbnail cache, run the below command.
rm -rf ~/.cache/thumbnails/*