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 examine files on Linux Linux provides very useful options for viewing file attributes, such as owners and permissions, as well as file content. By Sandra Henry Stocker Oct 24, 2024 6 mins Linux how-to 8 easy ways to reuse commands on Linux Typing the same command again and again can become tiresome. Here are a number of ways you can make repeating commands – or repeating commands but with some changes – a lot easier than you might expect. By Sandra Henry-Stocker Oct 15, 2024 5 mins Linux news SUSE Edge upgrade targets Kubernetes and Linux at the edge SUSE Edge 3.1 includes a new stack validation framework and an image builder tool that are aimed at improving the scalability and manageability of complex Kubernetes and Linux edge-computing deployments. By Sean Michael Kerner Oct 15, 2024 6 mins Edge Computing Linux Network Management Software how-to Lesser-known xargs command is a versatile time saver Boost your Linux command line options and simplify your work with xargs, a handy tool for a number of data manipulation tasks. By Sandra Henry Stocker Oct 11, 2024 6 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe