IPERAMUNA.COM
Seeing Real-Time Progress of Linux & macOS Commands Using pv
Article February 4, 2026

Seeing Real-Time Progress of Linux & macOS Commands Using pv

Stop working in the dark. Learn how to use 'pv' (Pipe Viewer) to add real-time progress bars, speed metrics, and ETAs to your Unix commands and data pipelines.

Most traditional Unix commands provide no visual feedback while they process data. When you're restoring a 50GB database or compressing a massive directory, this silence is more than just an annoyance—it's a productivity killer. You're left guessing: Is it working? Did it freeze? How much longer?

The pv (Pipe Viewer) tool is the elegant solution to this problem. It sits quietly in your command line pipes, monitoring the flow of data and providing a real-time progress bar.


What is pv?

pv is a terminal-based tool for monitoring the progress of data through a pipeline. It can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion.

The core philosophy of pv is simple:

source | pv | destination

It does not modify the data; it only observes.


Installation

pv is available in the default repositories of most major Unix-like operating systems.

Linux (Ubuntu/Debian)

sudo apt install pv

macOS

brew install pv

The Power of the Pipe

Here are the most practical ways to use pv in your daily DevOps and developer tasks.

1. Database Restores with Progress

Restoring a large SQL dump usually leaves you staring at a blinking cursor. Add pv to see exactly how fast the data is being injected.

pv backup.sql.gz | gunzip | mysql -u root -p dbname

2. Monitoring Large File Copies

While cp doesn't have a progress bar, you can use pv to mimic one.

pv big_disk_image.iso > /mnt/usb/backup.iso

3. SSH and Remote Transfers

When piping data over the network, pv helps you identify network bottlenecks by showing real-time transfer speeds.

pv big.tar.gz | ssh user@server 'cat > big.tar.gz'

4. Compressing Large Archives

See how fast your hardware is compressing data.

tar -cf - my_project_folder | pv | gzip > archive.tar.gz

Advanced Monitoring: Show Percentages

By default, pv only shows speed and a timer if it doesn't know the total size of the stream. To see a percentage and an ETA, you must tell pv the expected size.

On Linux:

pv -s $(stat -c%s data.file) data.file | command

On macOS:

pv -s $(stat -f%z data.file) data.file | command

Essential Flags

Flag Description
-p, --progress Show the progress bar.
-t, --timer Show the elapsed time.
-e, --eta Show the estimated time until completion.
-r, --rate Show the current data transfer rate.
-b, --bytes Show the total number of bytes transferred.
-s, --size Manually set the size of the data being monitored.

Why You Should Use This Method

  • Observable Systems: Turns "black box" operations into transparent ones.
  • Universal: Works with mysql, postgres, tar, gzip, scp, rsync, dd, cat, and even docker or kubectl.
  • Debugging: Easily detect slow disks, network throttling, or hung processes.
  • Mental Clarity: Knowing exactly when a task will finish allows for better time management.

Summary

pv is one of those small utilities that, once discovered, becomes an indispensable part of your toolkit. It brings the power of observability to the simplest of shell commands, ensuring you never have to work "blind" in the terminal again.

Pro Tip: Use pv whenever a file is larger than 100MB or an operation is expected to take more than 30 seconds.

Shell Scripts

Archive_tar

Copy_file

Install_linux

Install_macos

Mysql_dump

Mysql_restore

Percentage_linux

Percentage_macos

Ssh_transfer