Ubuntu does not ship with a single built-in graphical disk space monitor by default, but it provides several command-line tools and optional GUI applications to check disk usage. The most common are df for filesystem-level free space and du for directory-level consumption, while GUI tools like GNOME Disks and Baobab (Disk Usage Analyzer) offer visual breakdowns. You can also set up automated monitoring with scripts or third-party packages.
Why Ubuntu Lacks a Default GUI Monitor
Ubuntu's default desktop (GNOME) includes a Settings panel that shows basic storage information under Storage, but it does not provide real-time monitoring or per-directory breakdowns. This is by design: Linux traditionally expects users to employ command-line utilities for system inspection, and server installations have no GUI at all. The tools are present, but they are not consolidated into a single always-on monitor. Users who want continuous monitoring must either run a command periodically, install a dedicated application, or configure a system monitor like Conky.
This differs from Windows, where Task Manager and File Explorer surface disk usage prominently. On Ubuntu, the philosophy is modular: df reports capacity, du reports consumption, and tools like iotop or iostat report activity. Understanding this separation helps you pick the right tool for the job.
Command-Line Tools: df, du, and More
The two essential commands are df and du. They answer different questions and are often confused.
df(disk free) shows total, used, and available space per mounted filesystem. Rundf -hfor human-readable sizes (GB, MB). It reads filesystem metadata, so it is fast and accurate for capacity.du(disk usage) walks directories and sums file sizes. Rundu -sh /pathfor a summary of a directory, ordu -h --max-depth=1 /hometo see immediate subdirectory sizes. It can be slow on large trees because it stats every file.ncduis a curses-based interactive du viewer. Install withsudo apt install ncdu, then runncdu /to browse and delete large files. It is faster than raw du for exploration because it caches results.iotopandiostat(from sysstat) monitor disk I/O activity, not capacity. They help diagnose performance issues, not space shortages.
For a quick capacity check, df -h is the standard first step. If a filesystem is full, du or ncdu helps locate the culprit. Remember that deleted files still held open by a process do not free space until the process closes them; lsof +L1 can reveal such files.
Graphical Disk Usage Analyzers
For users who prefer a visual interface, Ubuntu offers several GUI tools. These are not installed by default on minimal installations but are available in the repositories.
- Baobab (Disk Usage Analyzer) is part of the GNOME desktop and often preinstalled on Ubuntu Desktop. It shows a treemap or ring chart of directory sizes, letting you drill down. Launch it from the application menu or run
baobab. - GNOME Disks (
gnome-disks) provides a graphical view of drives, partitions, and SMART health status. It can also benchmark read speeds and create disk images. It is not a space monitor per se but shows partition usage. - KDE Partition Manager and GParted are partition editors that display usage but are not intended for routine monitoring.
- Conky is a lightweight system monitor that can display disk usage on the desktop. It requires manual configuration but is highly customizable.
These tools are suitable for desktop users who want a quick overview. They do not provide continuous background monitoring or alerts; for that, you need a different approach.
Setting Up Automated Monitoring and Alerts
If you need to know when disk space runs low, you can create a simple script and schedule it with cron, or use a monitoring framework. Here is a basic approach using a shell script and cron.
- Create a script, e.g.,
~/check_disk.sh, that runsdf -hand checks the use percentage of a target filesystem. For example, parse the output ofdf --output=pcent /and compare it to a threshold like 90%. - If the threshold is exceeded, send an email using
mailorsendmail(requires a configured MTA), or write to a log file. - Make the script executable:
chmod +x ~/check_disk.sh. - Edit your crontab with
crontab -eand add a line to run the script hourly:0 * * * * /home/user/check_disk.sh.
For more robust monitoring, consider tools like Monit, Zabbix, or Prometheus with node_exporter. These are overkill for a single desktop but common on servers. Ubuntu's own Landscape (for enterprise) can monitor disk usage across machines. Always test your alerting path to ensure notifications arrive.
Common Pitfalls and How to Avoid Them
Disk space monitoring on Ubuntu has a few traps that can mislead even experienced users.
- Reserved blocks: ext4 filesystems reserve 5% of space for root by default.
dfshows this as used, so a filesystem at 100% for regular users may still have free reserved space. Adjust withtune2fs -mif needed, but be cautious. - Deleted but open files: As mentioned, a process holding a deleted file prevents space from being reclaimed. Use
lsof +L1to find them, then restart the process. - Inode exhaustion: A filesystem can run out of inodes (file table entries) even with free space.
df -ishows inode usage. This often happens with many small files, such as mail queues or session files. - Snap and Flatpak revisions: These package formats keep old versions, which can consume gigabytes.
snap list --allshows disabled snaps; remove them withsudo snap remove --revision. Flatpak hasflatpak uninstall --unused. - Log files:
/var/logcan grow unexpectedly. Usejournalctl --disk-usageto check systemd journal size, and configure rotation in/etc/logrotate.conf.
Regularly running df -h and du -sh /var/log can catch these issues early. For desktop users, Baobab's visual scan often reveals forgotten large files like old ISO images or virtual machine disks.
Comparing Monitoring Options
Choosing the right tool depends on your environment and needs. The table below summarizes the main options.
- df/du: Always available, no installation, ideal for quick checks and scripting. No GUI, no alerts.
- ncdu: Interactive terminal UI, fast for finding large directories. Requires installation, no continuous monitoring.
- Baobab: Graphical, easy for desktop users, shows treemaps. Not for servers, no alerts.
- Conky: Desktop widget, customizable, can show real-time usage. Requires configuration, not for headless systems.
- Monit/Zabbix/Prometheus: Full monitoring with alerting, suitable for servers and networks. Complex setup, overkill for single desktops.
For most Ubuntu desktop users, Baobab plus occasional df -h is sufficient. Server administrators should rely on df/du for quick checks and a monitoring system for alerts. There is no cost for any of these tools; they are free and open-source, though enterprise monitoring platforms may have paid support options.
Frequently Asked Questions
Does Ubuntu have a built-in disk space monitor?
Ubuntu includes command-line tools like df and du by default, and the GNOME desktop often includes Baobab (Disk Usage Analyzer). However, there is no single always-on graphical monitor preinstalled. You can check space via the terminal or install additional tools.
How do I check disk space in Ubuntu terminal?
Run df -h to see free space on all mounted filesystems in human-readable units. To find what is using space in a specific directory, use du -sh /path or du -h --max-depth=1 /path.
What is the difference between df and du?
df reports filesystem-level capacity and free space based on metadata. du calculates the size of files and directories by walking the directory tree. They can show different numbers because df includes reserved blocks and du may count hard links multiple times unless told otherwise.
Why is my disk full when df shows free space?
This usually means a process is holding a deleted file open, or the filesystem has run out of inodes. Check with lsof +L1 for deleted open files and df -i for inode usage. Restarting the offending process or removing unnecessary files resolves it.
Can I get disk space alerts on Ubuntu?
Yes, by writing a script that checks df output and sends an email, then scheduling it with cron. For more advanced alerting, use monitoring tools like Monit or Prometheus. Ubuntu does not provide built-in alerting for disk space.
How do I free up space on Ubuntu?
Use ncdu or Baobab to find large files and directories. Common space hogs include old kernels (remove with sudo apt autoremove), Snap revisions, Flatpak unused runtimes, and log files. Always verify what you delete to avoid removing system-critical files.