The pv command is especially helpful when you are running tasks that take a long time to complete and you want some feedback that displays your progress. Credit: BalanceFormCreative / Shutterstock The pv command is a rather unusual Linux command, but it can provide some insights into commands, especially those that send data through pipes. This includes some visual feedback that can sometimes be very reassuring as it tells you that something is occurring even when you’re sitting and waiting for some output to appear. The name “pv” stands for “pipe viewer” and you should be able to install it with one of these commands: $ sudo dnf install pv $ sudo apt -y install pv When you insert the pv command into a pipeline between two processes, its standard input will be passed through to its standard output and progress will be shown on standard error. It is commonly used to display such things as the time elapsed, the completed progress (percentage bar), the current data transfer speed (also referred to as the throughput rate), the data transferred and the estimated completion time. In this first example, the pv command with the -p (progress) option is examining a file and sending the data through a pipe to the wc command. $ pv -p myfile | wc [================================================================================================================>] 100% 1000 3275 22596 The numbers (as you may understand), represent the counts provided by the wc command (i.e., the lines, the words and the characters in the file). The pv command provided the long bar of equal signs even though no reassurance would be needed in such a fast-running command. This simple example is meant to show you what to expect as you get used to the command. In this next example, pv is simply copying a file to /tmp while sharing some data on the move. $ pv myfile > /tmp/myfile 22.1KiB 0:00:00 [ 136MiB/s] [========================================================================>] 100% Note that the bar gives an indication of the task’s progression. We also see the size of the file (22.1KiB) and the speed of its move to the /tmp directory (136MiB per second). With the -t (timer) option, pv displays the runtime and, again, the wc command shows the stats for the lines, words and characters in the file. $ pv -t H | wc 0:00:00 1000 3275 22596 In this next command, a backup is made of the local videos directory and the pv command provides the size of the resultant file and the rate of speed used (10.3MiB/s). Due to the speed, the time required didn’t amount to even one second. $ tar -czf - ./videos/ | (pv -c --timer --rate --bytes > video_backup.tgz) 57.3KiB 0:00:00 [10.3MiB/s] Here’s the file, so that you can get an idea of its size: $ ls -l video_backup.tgz -rw-r--r--. 1 shs shs 58630 May 25 12:49 video_backup.tgz Some of the more commonly used options for the pv command include the following. However, the man page is quite extensive and is worth looking over should you want to see what else you can do with this command. -p, --progress -t, --timer -e, --eta -r, --rate -a, --average-rate -b, --bytes Wrap-up The pv command is especially helpful when you are running tasks that take a long time to complete and you want some feedback that displays your progress. Related content how-to How to find files on Linux There are many options you can use to find files on Linux, including searching by file name (or partial name), age, owner, group, size, type and inode number. By Sandra Henry Stocker Jun 24, 2024 8 mins Linux opinion Linux in your car: Red Hat’s milestone collaboration with exida With contributions from Red Hat and critical collaborators, the safety and security of automotive vehicles has reached a new level of reliability. By Sandra Henry Stocker Jun 17, 2024 5 mins Linux how-to How to print from the Linux command line: double-sided, landscape and more There's a lot more to printing from the Linux command line than the lp command. Check out some of the many available options. By Sandra Henry Stocker Jun 11, 2024 6 mins Linux how-to Converting between uppercase and lowercase on the Linux command line Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy. By Sandra Henry Stocker Jun 07, 2024 5 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe