I Am Running Out of Disk Space-How Do I Free Up Some Space?
If you are concerned you may be running out of disk space, there are a few techniques that you can use to clear some room. Before you do anything you should get a report of how much disk space is available. Load up a terminal, and run the following command:
foo@bar:~$ df -h
The df command prints a listing of the free space on your disk. By passing it the -h option, more readable file sizes are displayed (e.g., 9.5G as opposed to 9887776). In addition to the file size, a percentage of how much space is left is displayed. If the line with / in the Mounted On column is nearing 100 percent, you need to clear some room. The / partition is where most of the software is installed.
The first thing you should do is to clean out your package cache. Every time a package is downloaded with Synaptic or with the automatic upgrade manager, it is stored in /var/cache/apt/archives/. You can clean out these packages without affecting your system. Just run the following command:
foo@bar:~$ sudo apt-get clean
With the package cache cleaned, you should now look for the largest directories on your system. This is where the command line can really come into its own. Run the following command:
foo@bar:~$ du -h /home | sort -nr | less
The du command lists disk usage for the /home directory (where users store their files). Again, the -h option makes the sizes more readable. The output of this command is fed into sort which organizes the output numerically (-n) and reverses the order (-r) to display the largest files first. Finally, the output is fed into less, which lets you scroll up and down through the listing.
Find the largest directories, and remove any unwanted files by either using the graphical file manager or the rm command.
foo@bar:~$ df -h
The df command prints a listing of the free space on your disk. By passing it the -h option, more readable file sizes are displayed (e.g., 9.5G as opposed to 9887776). In addition to the file size, a percentage of how much space is left is displayed. If the line with / in the Mounted On column is nearing 100 percent, you need to clear some room. The / partition is where most of the software is installed.
The first thing you should do is to clean out your package cache. Every time a package is downloaded with Synaptic or with the automatic upgrade manager, it is stored in /var/cache/apt/archives/. You can clean out these packages without affecting your system. Just run the following command:
foo@bar:~$ sudo apt-get clean
With the package cache cleaned, you should now look for the largest directories on your system. This is where the command line can really come into its own. Run the following command:
foo@bar:~$ du -h /home | sort -nr | less
The du command lists disk usage for the /home directory (where users store their files). Again, the -h option makes the sizes more readable. The output of this command is fed into sort which organizes the output numerically (-n) and reverses the order (-r) to display the largest files first. Finally, the output is fed into less, which lets you scroll up and down through the listing.
Find the largest directories, and remove any unwanted files by either using the graphical file manager or the rm command.
Post a Comment