Operations 5 min read

Master Linux Disk Monitoring: df, pydf, fdisk & sfdisk Commands Explained

This guide walks through essential Linux command‑line utilities—df, pydf, fdisk and sfdisk—showing how to display disk usage, list partitions, and query specific devices, with installation tips, example outputs, and practical options for clear monitoring.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Disk Monitoring: df, pydf, fdisk & sfdisk Commands Explained

df command

The df utility reports file‑system disk usage. Using the -hT options displays size, used space, available space, usage percentage, file‑system type, and mount point in a human‑readable format.

[root@localhost ~]# df -hT
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs  898M     0  898M   0% /dev
tmpfs                   tmpfs     910M     0  910M   0% /dev/shm
tmpfs                   tmpfs     910M   29M  881M   4% /run
tmpfs                   tmpfs     910M     0  910M   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs        37G  1.6G   36G   5% /
/dev/sda1               xfs      1014M  150M  865M  15% /boot
tmpfs                   tmpfs     182M     0  182M   0% /run/user/0

pydf command

pydf is a Python‑based alternative to df that adds colour‑coded output. It is not included by default in CentOS 7/RHEL 7; install it via pip (or apt on Ubuntu).

# Install pip on CentOS/RHEL
[root@localhost ~]# yum -y install python-pip
# Upgrade pip
[root@localhost ~]# pip install --upgrade pip
# Install pydf
[root@localhost ~]# pip install pydf

On Ubuntu: $ sudo apt install pydf Display all file systems:

[root@localhost ~]# pydf -a

Show usage in a human‑readable format:

[root@localhost ~]# pydf -h
Filesystem        Size  Used Avail Use%                          Mounted on
/dev/centos/root   37G 1624M   35G  4.3 [#.....................] /         
/dev/sda1        1014M  149M  865M 14.7 [###...................] /boot

fdisk command

fdisk is a classic Linux utility for partition management. The -l option lists all partitions and their device names.

[root@localhost ~]# fdisk -l

To view details of a specific disk, supply the device name after -l (e.g., fdisk -l /dev/sda).

sfdisk command

sfdisk offers scriptable partitioning similar to fdisk but can display sizes in megabytes using the -uM option.

[root@localhost ~]# sfdisk -l -uM
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcommand-linefdiskdfDisk Monitoringpydfsfdisk
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.