Ubuntu File Maintenance

Windows users frequently need to perform maintenance on their systems in order to ensure disk space is reclaimed.  These tasks usually involve tasks like, deleting temporary files, removing uninstallers, clearing cache files, defragmenting, etc… While Ubuntu has many of these functions built in, or doesn’t cause them in the first place, it is sometimes necessary to do a little maintenance to clean things up.

I have dug up a few tasks that generally amount to clean up tasks in Ubuntu.  It is worth noting that, unlike Windows, Ubuntu’s file system should not need to be defragmented.  I have heard of a few tools that do something like defragmentation, but the general consensus is that you don’t need them.

Most of the cleanup that needs to be manually done revolves around the removal of old programs and the installer (aptitude) data.  Most of this is kept, by design, so that if needed in the future it will be local instead of downloading the files again.  But, if you need the disk space, here are a few cleanup items.

  • Clean Up Residual Config Packages
  • Clean Up Partial Packages
  • Remove Unnecessary Locale Data
  • Clean Up Orphaned Files
  • Extra:  Clean Up Orphaned Files via Synaptic Package Manager

Whenever I have seen questions around recovering disk space, these are the common responses.  Ready?  Let’s do it!

Clean Up Residual Config Packages

In Synaptic Package Manger, there is a built-in feature that cleans up old Residual Config packages. Residual Config packages are usually dependency packages that are left behind after you uninstall a package from your machine. To use this feature, go to:

System > Administration > Synaptic Package Manager

On the bottom left hand corner of the window, click the Status button. In the list above the Sections, Status, Search, and Custom buttons, you should see the following text:
Installed
Installed (local or obsolete)
Not installed
Residual config

Click on the Residual config text.  If you do not have an option for Residual Config then step 1 is done.  Skip down to step 2.

You should now see packages in the window on the right.  Those are the Residual Config packages.

Click on the box to the left of the package name and select “Mark for Complete Removal“.

Once you have selected the packages, click Apply from the top of menu in Synaptic Package Manager.

All of the unused packages are now gone.

Clean Up Partial Packages (autoclean)

The autoclean option removes that can no longer be downloaded and are considered useless.  These packages were downloaded when you are installing via aptitude (apt-get) or Synaptic Package Manager.  Cleaning these files up is not a feature in Synaptic Package Manager, but can be done via a Terminal. Start by opening a Terminal, go to:

Applications > Accessories > Terminal

In the Terminal, enter the following text:
sudo apt-get autoclean

Enter your password when prompted and press Enter.

The package names that scroll past are partial packages that have just been deleted.

Remove Unnecessary Locale Data

For this tip, you need to download the “localepurge” package found in Synaptic Package Manager. “localepurge” is just a simple script to recover diskspace wasted for unneeded locale files and localized man pages. It will automagically be invoked upon completion of any apt installation run.

Open Synaptic Package Manager

System > Administration > Synaptic Package Manager

Once  Synaptic Package Manager is open, click the Sections button on the bottom left hand corner of the window.

Next, at the top of the Synaptic Package Manager window, click the Search button. In the search window, key in the following text :
localepurge

You should see a package named “localepurge” package window.  Click on the box next to the “localepurge” package name and select Mark for Installation.

Click the Apply button at the top of the window and wait for the downloading and installing of the “localepurge” package to finish. Once it is done, a new window should popup that has a bunch of abbreviations on it. for example:

en
fr
po
sp
ka
etc…

You want to select the abbreviation of the language that you speak, or use with Ubuntu, ignoring the capitalized ones. For example, I speak english, so I would select the “en” abbreviation. A french speaker would select the “fr” abbreviation. So on and so forth…

Once you have selected your language, Click Forward.

This setting will be invoked whenever an aptitude installation run successfully completes.

Clean Up Orphaned Packages

Orphaned Packages are installed but have no other programs that depend on them, which means they are unused.  The “deborphan” package is a good tool to handle this process.  It can be found in Synaptic Package Manager.

Open Synaptic Package Manager

System > Administration > Synaptic Package Manager

Once  Synaptic Package Manager is open, click the Sections button on the bottom left hand corner of the window.

Next, at the top of the Synaptic Package Manager window, click the Search button. In the search window, key in the following text :

deborphan

You should see a package named “deborphan” in the package window.  Click on the box next to the “deborphan” package name and select Mark for Installation.

Click the Apply button at the top of the window and wait for the downloading and installing of the “deborphan” package to finish. Once that is done, open up the Terminal.

Applications > Accessories > Terminal

In the Terminal, type the following text:
sudo deborphan | xargs sudo apt-get -y remove –purge

Enter your password when prompted and press Enter.

The package names that you now see on your screen, have been removed.

Adding a “Find Orphaned Packages” to Synaptic Package Manager

This is not really much of a tip on how to get rid of junk files. It’s more like adding a “deborphan” shortcut to Synaptic Package Manager so that you don’t have to use the Terminal to find “orphaned” packages.

Note: You must have the “deborphan” package installed or this will not work.

Start by opening Synaptic Package Manager

At the top of the Synaptic Package Manager window, click the Settings button, followed by the Filters button.

In the Filters window, on the bottom left hand corner, click the New button. You can name the new Filter if you like, but it is not necessary. I named mine “Orphaned”.

With your new Filter selected, in the “Status” tab on the right, click the Deselect All button.

Next, check the “Orphaned” option under the “Other” category. Then click the OK button.

To use this new filter, click the Custom button on the bottom left hand corner of the Synaptic Package Manager window. You should see the following text, or something similiar :

Broken
Marked Changes
(Your Filter)
Package with Debconf
Search Filter

Click on the name of the filter you created. The packages that appear in the package window are the “orphaned” packages.

To remove the orphaned packages, click on the box to the left of the package name and select “Mark for Complete Removal” and Click Apply from the top of the Synaptic Package Manager.

The orphaned packages should now be removed.

Credit
Original Author: Unknown
Details: Found at ubuntuforums.org

This entry was posted in System Administration, Ubuntu and tagged , , , , , , , , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback.

2 Trackbacks

  1. By Speeding Up a Slow Computer | Error Fix on April 18, 2010 at 9:57 am

    […] Ubuntu File Maintenance « It Is What It Is […]

  2. […] Ubuntu File Maintenance It Is What It Is […]

Leave a Reply

%d bloggers like this: