Using 'pydf' - Linux Tool for Viewing Color-Coded Filesystem Disk Space Usage

watch 3m, 27s
views 2

14:37, 11.03.2024

Article Content
arrow

  • Setting up pydf: Installation Guide
  • Installing pydf on RHEL/CentOS
  • Installing pydf on FreeBSD
  • Installing pydf on macOS
  • Personalizing pydf: Customizing Command Colors
  • Modifying pydf Output with Specific Block Sizes
  • Accessing Help Resources for pydf on Linux
  • Wrapping Up

The pydf (Python Disk File System) command is a command line tool for showing the amount of disk space used on a Linux-mounted filesystem. Pydf command is an alternative to “df” command: they perform the same function, but pydf shows the available disk space in different colors.

From what we’ve noticed, pydf is not commonly known but is still an excellent tool for displaying the amount of available disk space on the mounted filesystems with a different color assigned to each filesystem.

Let’s figure out how to use pydf command.

Setting up pydf: Installation Guide

Since pydf (Python Disk File System) is written in Python, it also exists as a Python package. Therefore, pydf can be installed through the Python package manager - pip. To install it through pip, run the following command:

pip install pydf

This way is general for Linux operating systems. Now, let’s see how to install pydf on different Linux distros.

Use the following command based on your operating system:

  • Ubuntu/Kali Linux/Debian: sudo apt-get install pydf
  • Arch Linux: sudo pacman -S pydf

It’ll look something like this:

[sudo] password for vivek:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  pydf
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.8 kB of archives.
After this operation, 46.1 kB of additional disk space will be used.
Get:1 <http://archive.ubuntu.com/ubuntu> focal/universe amd64 pydf all 12+nmu1[10.8 kB]
Fetched 10.8 kB in 1s (15.5 kB/s)
Selecting previously unselected package pydf.
(Reading database ... 324744 files and directories currently installed.)
Preparing to unpack .../archives/pydf_12+nmu1_all.deb ...
Unpacking pydf (12+nmu1) ...
Setting up pydf (12+nmu1) ...

Installing pydf on RHEL/CentOS

By default pydf is not installed on RHEL-based Linux distributions like CentOS, or Fedora. Thus, we need to install it manually.

Use the following command, if you are a RHEL, CentOS, Fedora or Rocky Linux user:

python3 -m venv pydf
$ source pydf/bin/activate
$ python3 -m pip install pydf

If you have an older version of RHEL/CentOS, use the dnf command or yum command first:

yum -y install pydf

Installing pydf on FreeBSD

If you’re using FreeBSD, you can use the following port:

cd /usr/ports/sysutils/pydf/ && make install clean

Alternatively, you can package through the pkg_add/pkg command:

pkg_add -r pydf

Installing pydf on macOS

To install pydf on macOS, use the following pip command:

$ python3 -m venv pydf
$ source pydf/bin/activate
$ python3 -m pip install pydf

Personalizing pydf: Customizing Command Colors

To start using pydf to show the used and available space within the mounted filesystem, run:

pydf

Furthermore,

  • To show the result in the “human-readable” format, add -h: pydf -h
  • To display the result in kilobytes, add -k option: pydf -k
  • To display the result in megabytes, add -m option: pydf -m
  • To display the result in gigabytes, add -g option: pydf -g
  • To disable colorized theme of the output, add –bw option: pydf --bw

If you want to leave colors but customize them, you can do that too through the pydfrc file. To customize pydf command, you need to edit the pydfrc file in the text editor:

sudo nano /etc/pydfrc

To perform configuration at a user level, create .pydfrc file in the user’s home directory:

cat /etc/pydfrc > ~/.pydfrc

And include the needed configurations.

Modifying pydf Output with Specific Block Sizes

To modify pydf output with a specific block size, insert the following:

pydf -k
$ pydf --kilobytes
$ pydf -m
$ pydf --megabytes
$ pydf -g
$ pydf --gigabytes


Filesystem         Size Used Avail Use%                                                                                         Mounted on
/dev/vgubuntu/root  915  153   715 16.7 [##############.......................................................................] /

Accessing Help Resources for pydf on Linux

If you need help regarding the pydf tool, you can access it through:

$ pydf --help

Wrapping Up

Pydf is a useful tool, but it might not be installed by default. However, with this guide for using the pydf command, you’ll find the manual installation easy.

We hope you found it helpful!

Share

Was this article helpful to you?

VPS popular offers

-10%

CPU
CPU
6 Xeon Cores
RAM
RAM
16 GB
Space
Space
400 GB HDD
Bandwidth
Bandwidth
Unlimited
KVM-HDD 16384 Linux

50 /mo

/mo

Billed annually

-9%

CPU
CPU
6 Xeon Cores
RAM
RAM
16 GB
Space
Space
150 GB SSD
Bandwidth
Bandwidth
Unlimited
wKVM-SSD 16384 Windows

57.7 /mo

/mo

Billed annually

-15.6%

CPU
CPU
3 Xeon Cores
RAM
RAM
1 GB
Space
Space
20 GB SSD
Bandwidth
Bandwidth
30 Mbps
DDoS Protected SSD-KVM 1024 Linux

38 /mo

/mo

Billed annually

-13.1%

CPU
CPU
2 Xeon Cores
RAM
RAM
512 MB
Space
Space
10 GB SSD
Bandwidth
Bandwidth
300 GB
KVM-SSD 512 HK Linux

7 /mo

/mo

Billed annually

-20.6%

CPU
CPU
6 Xeon Cores
RAM
RAM
8GB
Space
Space
100GB SSD
Bandwidth
Bandwidth
500GB
KVM-SSD 8192 HK Linux

59 /mo

/mo

Billed annually

-10%

CPU
CPU
6 Xeon Cores
RAM
RAM
8 GB
Space
Space
200 GB HDD
Bandwidth
Bandwidth
300 Gb
KVM-HDD HK 8192 Linux

20.68 /mo

/mo

Billed annually

-9.5%

CPU
CPU
4 Xeon Cores
RAM
RAM
8 GB
Space
Space
100 GB SSD
Bandwidth
Bandwidth
Unlimited
10Ge-wKVM-SSD 8192 Windows

121.5 /mo

/mo

Billed annually

-5.6%

CPU
CPU
4 Xeon Cores
RAM
RAM
2 GB
Space
Space
60 GB HDD
Bandwidth
Bandwidth
Unlimited
wKVM-HDD 2048 Windows

13.7 /mo

/mo

Billed annually

-7.4%

CPU
CPU
4 Xeon Cores
RAM
RAM
4 GB
Space
Space
100 GB SSD
Bandwidth
Bandwidth
Unlimited
wKVM-SSD 4096 Windows

23.1 /mo

/mo

Billed annually

-10%

CPU
CPU
8 Epyc Cores
RAM
RAM
32 GB
Space
Space
200 GB NVMe
Bandwidth
Bandwidth
Unlimited
KVM-NVMe 32768 Linux

96.8 /mo

/mo

Billed annually

Other articles on this topic

cookie

Accept cookies & privacy policy?

We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the HostZealot website.