Affiliate Disclosure: By buying the products we recommend, you help keep the lights on at MakeUseOf. Read more.
So you decided to dive into the not-so-scary world of Linux and, as it turns out, you’re actually having a blast. That’s usually how it goes, and many people find that Linux is much easier than they expected.
But one problem that every newbie eventually faces — although not until they’ve used Linux for a while — is how to free up used space. After installing so many cool apps and packages, it’s easy to find your disk partition clogged to its limit.
Fortunately, there are two easy commands that you can run that instantly clean up disk space. To begin, open up a terminal and type in the first one:
sudo apt-get autoremove
When you install new packages, sometimes they have prerequisite packages that must be installed beforehand. These are called dependencies. The thing is, when you uninstall packages, dependencies aren’t always removed and they end up taking up space for no reason.
The autoremove command deletes all dependencies that are no longer needed on your system.
sudo apt-get clean
When you install new packages, you actually download package files to your system (kind of like installer files on Windows), but even after packages are installed, they remain on your system (in case you need to install them again, you won’t have to re-download them). Obviously, this takes up a lot of space.
The clean command deletes all of these cached package files. There’s no risk in doing this. If you ever need to re-install a package, the package manager will just re-download it as necessary.
Note that these exact commands only work on systems using the apt-get package manager. Other package managers may have similar commands that do the same thing, but it’ll be up to you to find out what they are.
Got any other tips for quickly cleaning Linux disk space? Share with us in the comments below!
Image Credit: Linux on a Laptop by fatmawati achmad zaenuri via Shutterstock