Ubuntu Housekeeping

I’m a Linux nerd that spends some time in Vista. I tend to be a bit obsessive-compulsive, so I’ve found that I enjoy running CCleaner, defragging, and so forth.

The problem is that Linux isn’t as crazy about accumulating cruft (at least, most things aren’t; if you set up custom log files and don’t set up logrotate to match, then you might… But that’s a problem of your making.) And ext3 doesn’t get fragmented*. (* That’s not entirely true, it’s just that fragmentation isn’t a big issue.)

So if you’re like me and have come to miss the housekeeping, here are some things you might want to do:

  • Empty the trash. It used to be ~/.Trash, but newer versions (Hardy and on, apparently) keep it in ~/.local/share/Trash, with a “files” and “info” subdirectory. Always be careful with rm -rf, but rm -rf ~/.Trash/* or rm -rf ~/.local/share/Trash/info/* && rm -rf ~/.local/share/Trash/files/* ought to do the trick.
  • Some apt-get housekeeping:
    • Check everything over (e.g., for errors): sudo apt-get check
    • Remove old packages not used by anything: sudo apt-get autoremove
    • Clean out your local repository of package files:
      • The soft way, just removing “package files that can no longer be downloaded, and are largely useless.”: sudo apt-get autoclean
      • The hard way, removing most everything from /var/cache/apt/archives: sudo apt-get clean
  • Figure out where your disk space is going: du -sh ~/*. This isn’t super-easy to interpret, though. (And it can take a while, since it looks at all of your home directory.) Applications / Accessories / Disk Usage Analyzer is way cooler.) It makes it easier for me to realize that, for example, the reason I have very little disk space is that I have my old 55GB Windows partition backed up. Since that’s copied to another disk, I can pretty safely blow that away, and have 50GB of disk to spare. It also turns up a few DVD ISOs (CentOS 5.1?!) that I definitely don’t need.

The good news is that this did clean up some junk. It saved about 200MB of disk. (Not counting the ~50GB of backups I had created that I don’t need.) The bad news is that this really doesn’t do much that doesn’t get run when dealing with packages anyway. But it makes me feel good.

2 thoughts on “Ubuntu Housekeeping

  1. Well my point, maybe not well-made, was that most of this stuff is done automatically and that these are for people who want to feel like they’re doing some sort of housekeeping. 😉

    You can just right-click on the trash icon and do “Empty Trash,” and apt-get seems to do a pretty good job of keeping its archives clean. That one’s for the “Caches are designed to be kept empty!” people.

    “du -sh *” only got mentioned because I’ve found myself using it often on headless servers. Gnome has one of the spiffiest disk usage GUIs I’ve ever seen, but we don’t have Gnome installed on our load balancers at work. 😉

Leave a Reply

Your email address will not be published. Required fields are marked *