Share your love
Easy Steps Display Disk Space on Ubuntu 22.04
In this tutorial, we want to teach you to Display Disk Space on Ubuntu 22.04. Disk Space is defined as a utility that helps the user with the space left in the system’s disk. Within this utility itself, numerous sub-utilities allow the user to perform specific tasks. A few examples of such tasks are managing the disk space, checking the disk space, freeing up the disk space, etc.
Table of Contents
Steps To Display Disk Space on Ubuntu 22.04
To complete this guide, you must log in to your server as a root or non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Ubuntu 22.04.
1. Check Disk Space with df Command
The df command displays the amount of disk space available on the filesystem with each file name’s argument. You can simply use the command below:
df
You will get something similar to this:
If you want to check disk space usage in human-readable format, use the -h option:
df -h
2. Check the File System Type on Ubuntu 22.04
At this point, you can easily use the df command with the -T option to display the file system type:
df -T
To display the information about the ext4 partition, run the following command:
df -t ext4
ext4 is the default file system for many Linux distributions including Debian and Ubuntu.
3. Check Disk Space with du command on Ubuntu 22.04
The du (disk usage) command measures the disk space occupied by files or directories.
To display the disk space usage of your current directory, you can use the command below:
du
And, to display the information in human-readable format, run the following command:
du -h
To display the total disk space usage of the specified directory, you can use the -hs option:
du -hs /var/log
Output
848K /var/log
Also, you can use the du command with the sort parameter to sort the files and directories by size:
du -h | sort -rn
Conclusion
Monitoring disk space is essential for maintaining system performance and preventing storage-related issues. Ubuntu 22.04 provides several reliable tools to check disk usage, including the df and du commands. At this point, you have learned to Display or Check Disk Space on Ubuntu 22.04.
Hope you enjoy it. You may like these articles:
Install and Configure Lighttpd on Ubuntu 22.04
How To Install OTRS on Ubuntu 22.04