Monitoring disk usage is an important system administration task to avoid running out of storage. This comprehensive guide covers multiple methods and commands to check disk space in Ubuntu 22.04.
There are several key reasons to regularly monitor disk utilization on Linux servers and workstations:
Checking disk space should be part of regular Linux server maintenance. Monitoring tools can also automatically alert when usage exceeds thresholds.
Read: How to check memory usage on Ubuntu 22.04
There are several Linux commands and utilities that provide visibility into disk usage:
The df (disk free) command displays disk space details for file systems.
Linux check disk space
To show all mounted filesystems:
df -h
This prints filesystem, 1K-block size, used space, available space, capacity, and mount point. The -h flag prints human readable format in GB, MB, etc.
Read: How to fix high memory usage in Linux
To show just a specific filesystem:
df -h /home
The du (disk usage) command reports space occupied by directories and files.
Show disk usage summary for current directory:
du -sh
The -s flag prints total rather than individual file sizes. The -h displays human readable format.
Check disk usage for a specific folder:
du -sh /var/log
Using du -sh * prints size of all directories and files in current folder.
Read: Moving the Home folder to another partition in Ubuntu
The fdisk command shows disk partition information including size.
List partitions on first disk drive:
fdisk -l /dev/sda
This prints details like partition size, type, and mount point for each partition on that disk.
The ncdu tool scans directories and provides an interactive ncurses-based interface to browse disk usage.
To scan current directory:
ncdu
ncdu
It allows drill-down analysis into subfolders and sorting by size to identify what is consuming excess space.
GUI tools provide visual representations of disk usage.
Baobab is a Gnome disk usage analyzer. To install it run:
To launch:
baobab
It provides a graphical tree map of folders and enables drilling down into them to identify and clean up space.
The post How to Check Disk Space in Ubuntu 22.04 appeared first on net2.
In this article, we will see how to install nvidia-smi on Ubuntu or Debian Linux.…
In this article, we will see how to install clang tool on Ubuntu or Debian…
When working with Docker containers on Raspberry Pi devices, you might encounter frustrating signature verification…
You’ve recently upgraded to Ubuntu 18.04 and found that your OpenVPN connection no longer resolves…
Have you ever tried to open System Monitor on your Ubuntu 18.04 system only to…
System hardening means locking down a system and reducing its attack surface: removing unnecessary software…
View Comments