It seems that no matter how big drives get, we’re always looking for more storage space. When you need to squeeze a few more bytes out of the storage devices on your Ubuntu system, these tools will show you where to look.
If you prefer to work with a graphical interface, there are several great tools available to help you monitor and manage your storage space on Ubuntu. Whether you’re looking to do some light cleaning or completely reorganize partitions on your drive, these programs will help you get the job done.
Disk Usage Analyzer
Disk Usage Analyzer comes preinstalled on most systems that use GNOME, which is the default desktop environment for Ubuntu. You’ll find this program in the Utilities folder from the main app launcher. When the program first loads, it will let you select which file system you’d like to analyze.
You will see at least two drives. “Home Folder” contains all of your personal files. This is most commonly where you’re going to be looking if you need to free up space. Depending on how your system is set up, you might see several other options. Generally, it is not recommended to move or delete any files outside your home folder unless you know exactly what you are doing. Mistakes could render your system unbootable.
Clicking on a drive will take you to a split-screen analysis of the storage space. On the left side, you’ll see an expandable directory tree. Default settings will list folders that occupy the most space first. You can then expand each folder to see what files or subfolders take up the most space from there and continue to drill down as far as you like.
The right side of the window shows a graphical representation of files and folders with their relative sizes. You can click on parts of the graphic and the corresponding folders will be opened in the left panel. Clicking on the left panel will, likewise, change the graphic on the right.
GNOME Disks
You’ll also find GNOME Disks in the Utilities folder. It will be labeled simply Disks. This is the tool you’ll want to use if you need to manipulate partitions and file systems on your drive(s). It will let you do things like remove, resize, and create partitions, as well as change the type of Linux filesystem used on any of your partitions. It can also be used to encrypt data on your drive for higher security and privacy.
GNOME Disks is very easy to use, but it should be used with great care. You can potentially wipe out all of the information on your system with just a few clicks. Unless you’re a fairly advanced user, you should read documentation carefully and back up all of your data before attempting any operations on disk partitions.
GNOME System Monitor
You’ll find the system monitor in the main app launcher. It provides a high level overview of drives and file systems. To get a quick overview of your system storage, simply click on the “File System” button on the top right.
System monitor will list all file systems it finds, displaying the total space, space used, and space free. Double clicking on any file system will open it in the file explorer.
Aside from the standard GUI tools, there are also some great storage management utilities available at the terminal command line. In many cases, they can give you more information faster than their graphical counterparts.
df
The simple name of the df utility is short for disk free. It does one thing, and does it well. It will tell you the size of a file system, how much space is used, and how much space is free. Simply enter the command df -h at the command prompt (the -h tells df to present output in human-readable form). You’ll immediately get a summary of all the file systems on your machine.
df can be particularly useful if you have a folder, such as Downloads, and don’t know exactly what file system it is on. If you enter df -h ~/Downloads, it will show you the disk free information for only the file system where that folder exists, making it clear how much room you have available.
du
Another simply named utility, du stands for disk usage. You should also use the -h switch with du to get back human readable storage numbers. Typing du -f on it’s own will return a listing of the full current directory tree with the size of each file found. In general, this is going to be far too much information to be useful.
Where du really shines is when you want to find out how much space specific folders occupy on your drive. For example, the command du -h ./.local/share will give you output similar to what you see in the picture below.
du goes through the .local/share folder recursively, showing you the size of every file it finds. At the end of the list, you see the total size of everything stored in the folder collectively. This can be especially useful when trying to figure out how much space is occupied by things like application and system caches and logs.
pydf
pydf works similar to df but with a bit more detail and arguably better presentation. It is not installed on Ubuntu by default but you can install it in just a few seconds by typing sudo apt install pydf at the command prompt. Once installed, just type pydf to view the output.
As you can see, pydf adds a bit of color and provides a progress bar type indicator to give you a more visual idea of just how much space is used on each file system. Like df, you can also include the name of a file or directory and pydf will show you the storage space information for the file system where that file or folder is stored.
Quick and Simple Ways to Free Storage Space
Even if you’re not looking for a detailed breakdown of everything that is taking up space on your system, there are few things you can do to quickly free up storage space. There are many temporary files that can build up over time and consume significant amounts of your precious drive space.
Uninstall Unused Apps
We’re all guilty of installing something we thought we wanted or needed and then never using it again. It’s a good idea to go through the entries in your app launcher every so often and get rid of programs that you don’t use. You’d be surprised how much space you can recover.
Just make notes of the apps you don’t want and remove them through the software center. Alternatively, you can open a terminal and type sudo apt remove [appname] to clear them out.
Autoremove Unused System Packages
Over time, it’s common for unused packages to build up on your system because of upgrades, updates, and other system maintenance processes. To clear out everything that is no longer in use, open a terminal prompt and type sudo apt autoremove. The package manager will examine your system and remove anything that is no longer necessary. Especially on older systems, this can free up significant amounts of disk space.
Clean Apt Cache
Apt itself keeps a large cache of packages and metadata. This is necessary, to a point. The system, however, doesn’t always get rid of unneeded data efficiently. You can help it along by typing sudo apt clean at a terminal prompt.
Clean Cache Directories
Open your file explorer and press Ctrl+H. This will show you the hidden files in your home directory. One of them will be a folder called “.cache”.
Don’t erase the .cache directory itself, but double click to open it and see what’s inside.
You can safely delete everything here. You may see that some files can’t be deleted if they are in use by any applications you currently have running, but you can move the majority of what you see to the trash. This will free up considerable space and your apps will rebuild any required cache as they need it, often taking up much less space.
The best way to put these tools to work for you is to monitor and maintain your storage space on a regular basis. If you use these tools and resource-saving suggestions once every month or two, you’ll always have plenty of space free for new apps, documents, and projects.