3 Ways to Free Up Disk Space on Your Linux System
Even though modern hard drives have quite a bit of space, it’s not uncommon to have Linux systems run out of disk space. Luckily, there are plenty of ways to free up disk space on your Linux system without having to buy any new hardware or change your habits. This guide will go over three common approaches to freeing up disk space on your Linux system and how you can choose the one that works best for you and your situation odisha discom.
Delete Unused Packages
If you’re using a Debian-based system (like Ubuntu), you can use the apt command to remove packages that are no longer needed. First, update your package list:
`sudo apt update`
Then, use the `autoremove` option to remove packages that were automatically installed to satisfy dependencies for other packages and are no longer needed Piso WiFi :
`sudo apt autoremove`
You can also use the `clean` option to remove all cached packages from your system. However, this should be done with caution as it may lead to unintended consequences if not executed properly. There is an alternative way of removing unused packages by sorting them based on size and removing the largest ones first. For example:
`sudo find /var/cache/apt/archives -name *.deb -exec du -h {} \; sort -n head -n 10` To find which packages take up the most space, use this command: `sudo dpkg –get-selections grep ‘^rc’ cut -d’ ‘ -f1 uniq` `grep ^rc * awk ‘{ print $2 }’ sed ‘/^$/d’` `find . -type f -size +50000c -exec ls {} \; sed ‘/^$/d’` `find . -type f -size +50000c -exec ls {} \;`. `.`unzip -l winrar*.zip`.`
Check and Purge Old Log Files
If you’re looking to free up some disk space on your Linux system, one place you can start is by checking for and purging old log files. Log files can quickly eat up space, so it’s a good idea to clean them out regularly. Here are three ways to do it 1) Check the size of the log directory with du -h -d 1 /var/log . 2) Enter this command: find /var/log -type f -mtime +14 xargs rm. You may want to leave the most recent 7 days worth of logs before running this command. The -type option will remove only the specified type of file from the directory, in this case f. The -mtime option specifies how far back in time (-14 = 14 days ago).
Finally, we pipe these commands into xargs which will execute them for us (using sudo if necessary). 3) Purge an individual log file using sudo find /var/log -name ‘somefile’ -exec rm {} \; where somefile is whatever filename you are looking to purge. Notice that the \; at the end makes sure that nothing else is run after removing the specified file. If none of these solutions seem right for you, check out a program like BleachBit. It deletes unnecessary items such as browser cache, logs, and much more. It’s easy to use, just click Cleanup and then select what items you would like to delete.
Also Read: Errordomain=Nscocoaerrordomain&Errormessage=Opgegeven Opdracht Niet Gevonden.&Errorcode=4
Delete Caches for Programs You Don’t Use Anymore
If you’re using a Linux system, there are a few ways you can go about freeing up some disk space. One way is to delete caches for programs you don’t use anymore. Caches are basically temporary files that are created when you use a program. Over time, these files can start to take up a lot of space. To delete the caches for programs you don’t use anymore, simply run the clear cache command in your terminal. For example, if you have Firefox installed and want to clear its cache:
- $ sudo apt-get remove firefox
- $ sudo apt-get autoremove
- $ sudo apt-get clean $ sudo apt-get autoclean
- $ sudo rm -rf ~/.cache/*