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. |
|||||
|
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). |
|||||||||||||||||||||
|
|
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) |
|||||||||||||||||
|
see list of all installed packages, sorted by size. If you see something big and don't use it - uninstall it
or
|
|||||||||
|
|
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 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:
|
||||
|
|
|
I really recommend you the program BleachBit, which cleans everything on Ubuntu. Install it using the following command:
|
||||
|
|
|
If you use UFW, check the log folder. On one of my machines, UFW was generating 8Gb of logs in a couple of days. You could also empty the apt cache with:
|
|||||||||
|
|
Try using BleachBit (located at sourceforge). It is a great program. the basic idea is that it quickly frees up disk space and removes a lot of the junk that is hidden in the system. There are about 70 applications that it can recognize and wipe clean. There is also the ability to use it to "wipe" the free disk space. I think of it as CCleaner from windows only for linux. |
|||||||||
|
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! |
||||
|
|
Uninstall large packages that you don't useSome packages can be quite large. A convenient way of finding these is to use
Then:
There are a few options:
|
||||
|
|
|
Check for large numbers of log files too:
Or as rubo77 points out in commends, you could use the NCurses disk usage tool:
|
|||||||||||||
|
|
First, there is a tool for listing all big folders and files. Just type 'Baobab' into the launcher. By removing folders and files you don't need you get more space. Then, there is a program for removing double files. The program is called
in a Terminal. or graphically You can also clear the package cache with
The fourth step is to remove old Kernel entries. You can do this by installing and opening Synaptic. In Synaptic, search for the old Kernel entries (every Kernel entry that is displayed in GRUB except the newest) and remove it. One good step is to remove the application cache. Do this by installing and running
or graphically Important: Deleted cache cannot be restored! The last step is to defragment the file system. Do the following for this:
With these commands, you download and compile e2fsprogs. (If you or the community has got a better way to install the program, please edit!) Also make sure that
Now you can run the program with:
Replace /dev/sda1 with the file system or folder/file you want. Note that for defragmenting a device (such as HDD) you need root privilegs, but not for your own files. Source (German): here |
|||||||||
|
|
The '/tmp' directory should never be cleaned up manually unless absolutely necessary (ie: a closed application didn't clean-up after itself). You can search where space might be filling up using the 'du' command; usually places of interest are inside '/var'. To name two usual suspects '/var/log' and '/var/cache'. Though I've had some users who install a backup utility and never realise that it creates GBs of incremental backups in '/var/backup' that build up over a week or month to fill the entire disk space. |
|||||
|
|
Use ubuntu-tweak to clean. it cleans all *.deb that are downloaded to installation apps. |
|||||
|
|
This script will execute the biggest chunks on the console:
create a file with this content and give it executable rights:
Adapted from 71529-ubucleaner.sh Some tools that will help you find large folders and packages:
Use localepurge to uninstall unused languages in your system:
A great graphical GUI tool to fit all needs:
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:
|
|||||||||||||
|
|
When I need make more free space on servers I use this command. It find all files bigger then 50 MB and "du -h" make better list of files and "sort -n" after pipe make list numericcaly sorted by file size.
|
|||||||||
|
|
If you have already deleted a lot of junk but disk space does not seem cleaned just reboot ubuntu. Or if you don't want to reboot just run command like in similar question.
|
||||
|
|
( to see yours )
( yours older versions ). It gave me 600mb freed space. |
|||||
|
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?