Share your love
How To Display Disk Space on AlmaLinux
This article intends to teach you to Display or Check Disk Space on AlmaLinux.
The Linux operating system can seem a bit technical but generally offers greater control to users. Managing disk space on Linux servers is an incredibly important task; if you run out of space on a server, your websites can crash.
There are many ways by which we can check the Linux system disk space. You can use a third-party app that displays the available disk space. Another way is the command line by the Linux Terminal, some of which are df and du, where du means disk space used and df means disk space free.
Steps To Display Disk Space on AlmaLinux
To complete this guide, you must log in to your server as a root or non-root user with sudo privileges. You can visit these Initials Guides on AlmaLinux:
Initial Server Setup with AlmaLinux 9
Initial Server Setup with AlmaLinux 8
Check Disk Space with df Command on AlmaLinux
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:
Output
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 1893468 0 1893468 0% /dev
tmpfs 1910644 0 1910644 0% /dev/shm
tmpfs 1910644 8592 1902052 1% /run
tmpfs 1910644 0 1910644 0% /sys/fs/cgroup
/dev/sda1 51024384 2100452 46312672 5% /
tmpfs 382128 0 382128 0% /run/user/0
If you want to check disk space usage in human-readable format, use the -h option:
df -h
Output
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.4M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 49G 2.1G 45G 5% /
tmpfs 374M 0 374M 0% /run/user/0
Check File System Type on AlmaLinux
At this point, you can easily use the df command with the -T option to display the file system type:
df -T
Output
Filesystem Type 1K-blocks Used Available Use% Mounted on
devtmpfs devtmpfs 1893468 0 1893468 0% /dev
tmpfs tmpfs 1910644 0 1910644 0% /dev/shm
tmpfs tmpfs 1910644 8592 1902052 1% /run
tmpfs tmpfs 1910644 0 1910644 0% /sys/fs/cgroup
/dev/sda1 ext4 51024384 2100452 46312672 5% /
tmpfs tmpfs 382128 0 382128 0% /run/user/0
To display the information about the ext4 partition, run the following command:
df -t ext4
Output
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 51024384 2100452 46312672 5% /
ext4 is the default file system for many Linux distributions.
Check Disk Space with du command on AlmaLinux
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
Output
32 .
And, to display the information in human-readable format, run the following command on AlmaLinux:
du -h
Output
32K .
To display the total disk space usage of the specified directory, you can use the -hs option:
du -hs /var/log
Output
4.5M /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
Output
32K .
Conclusion
At this point, you have learned to Display or Check Disk Space on AlmaLinux.
Hope you enjoy it. You may be like these articles from Orcacore Blog: