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

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

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!

views 3m, 27s
views 2
Share

Was this article helpful to you?

VPS popular offers

Other articles on this topic

Backup VPS
Why choose VPS with Ubuntu
Backup VPS
Why choose VPS with Ubuntu
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.