My Ubuntu cloud server has left only 900MB of disk space.
I'll just empty the directory /tmp and wondering if there is any other location to clean up.
My Ubuntu cloud server has left only 900MB of disk space.
I'll just empty the directory /tmp and wondering if there is any other location to clean up.
To delete downloaded packages (.deb) already installed (and no longer needed)
To remove all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repository or that have a newer version in the repository).
To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore)
To delete old kernel versions
If you don't know which kernel version to remove
Source: Limpiando Ubuntu: comandos y programas (actualización) (google translated)
Show top 10 biggest subdirs in the current dir.
Use File Usage Analyzer (AKA baobab; GNOME based), Filelight or kDirStat (KDE based), to see where the disk space is going visually (
ncdu
uses a TUI).Check if you have old kernels for deletion
Cleaning packages
see list of all installed packages, sorted by size. If you see something big and don't use it - uninstall it
Clean unused language files with translations (there are tons of them)
Check content of /var/tmp/
Check also
Search for big files:
or
Big installed packages (part of the package: debian-goodies)
or
wajig sizes | tail -30
.On systemd: Remove the oldest archived journal files until the disk space they use falls below the specified size
Limit Tracker disk usage.
That can clean out a lot of guff (old kernels, etc) that have been replaced. You can do a similar thing in Synaptic (load it up and select the status button and then the Auto-removeable option).
I just freed up almost 2 gigs by removing old kernels and header files:
use
to check your current version, then
to see all the old kernels and header files, then
the
apt-get remove
command supports wildcards, so you can doapt-get remove linux-image 3.0.* linux-headers-3.0.*
for example, to get rid of many at once.Make sure you don't kill remove current kernel of course! And maybe keep one or two old version, just in case... but not 10 or 20!
Do not forget to Empty Trash.
Or from command line:
Or just
trash-empty
using trash-cli package.Uninstall large packages that you don't use
Some packages can be quite large. A convenient way of finding these is to use
dpigs
. It's not installed by default but can be found indebian-goodies
(GitHub project)Then:
There are a few options:
I really recommend you the program BleachBit, which cleans everything on Ubuntu. Install it using the following command:
Remove all old kernel versions automatically
Remember to check which kernel you are using type:
Then as root:
read that thread to be safe not to remove needed kernels with this command!
Check for large numbers of log files too:
Or as rubo77 points out in commends, you could use the NCurses disk usage tool:
Cleaner script
This script will execute the biggest chunks on the console:
--purge
switch withapt-get
)create a file with this content and give it executable rights:
Adapted from 71529-ubucleaner.sh
Find large folders and packages
Some tools that will help you find large folders and packages:
Localepurge
Use localepurge to uninstall unused languages in your system:
Remove old snapd images
More here.
Bleachbit
A great graphical GUI tool to fit all needs:
More here.
Remove manpages and documentation
Additionally you can remove manpages and documentation as described in the Ubuntu Wiki:
Create a file /etc/dpkg/dpkg.cfg.d/01_nodoc which specifies the desired filters. Example:
Remove the same set of files and directories in the project-config's postinst. Example: