Sunday, 27 November 2016

How to free up space in Linux [Debian based]

Running out of storage? If you are running out of space in your Linux system, these simple steps will help you in freeing up some space in your Linux system. 

When you install an application, the packages are downloaded to your system. However, once the installation is complete, these downloaded packages remain in the system and take up space. So, to remove downloaded packages that are already installed and no longer needed, type in the following command in terminal : 

sudo apt-get clean

Some packages becomes obsolete or have a newer version in the repository, you can remove those packages stored in your cache by typing the following command : 

sudo apt-get autoclean 

To remove these un-necessary packages that have been left after the uninstalling an app, use the below command : 

sudo apt-get autoremove

The autoremove also deleted the dependencies that were installed during the installation of the application and are taking up space in your system.

To see the installed packages which are sorted by size : type the below command : 

dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -nr | less 

If you see any app that is taking a chunk of space in your Linux system which you do not use, uninstalling it can be good way of freeing up space in Linux. 

Remove files from /var/tmp

The /var/tmp directory stored temporary files which you do not need it. Check the size and delete the bigger ones.

Remove old kernels and header files. 

Check your current Kernel version by typing 

uname -r 

Now, check the old kernels and header files : 

dpkg -l linux-image-* linux-headers-* 

Now, remove the older kernel versions from your system : 

sudo apt-get remove linux-image-oldKernel linux-headers-oldHeaders 

Lastly, check for the Trash and clean it. Also, if you are movie junkie like me, chances are that half of your storage is filled up with movies. When I run out of space, I check the list and deletes those which I am not interested in watching again!

Is there any other way you know which can free up some space in a Linux system? Tell us in the comments. 

0 comments:

Post a Comment