Viewing Progress of Commands Using Pipe Viewer Tool in Linux
Last Updated :
17 Oct, 2024
The Pipe Viewer (pv) tool is a command-line application that allows Operators to monitor the progress of information along the pipeline. It provides important information such as the amount of arsenic information transferred and the order in which the previous sentences are modified partly at the end. This tool is handy for methods that do not have built-in progress indicators because it allows administrators to monitor progress visually.
Why do we require it?
Some processes have inbuilt functionality or via parameterized to show the progress of the process, but some processes don’t have this, so we externally pass this from the Pipe Viewer tool and track the progress.
Pipe Viewer (pv): a CLI tool to track the progress of the process.
Options for the Pipe Viewer tool
- -s, --size <size>: Assume the total amount of data to be transferred is SIZE. You can provide the size in bytes or using units (b, kb, mb, gb, tb).
- -N, --name <name>: Prefix the output information with NAME.
Installation Process: It uses the npm (node package manager) and to install this run the following command.
$ npm install -g pv

Here providing some examples to better understanding and to learn the use of this tool.
Practical Examples of Using Pipe Viewer (pv)
Example 1: Display a dd copy progression
Here we can see the progression of the copying file using dd command.
$ dd if=code_1.46.1-1592428892_amd64.deb | pv | dd of=gfg/code_2

Explanation: here in this screenshot we can see the file which contains by current directory, and we will copy the code_1.46.1-1592428892_amd64.deb file in 'gfg/' directory with the name of 'code' .
Example 2: A cat command progression
We can use the pv to visualize the progress of the content seeing using cat command. Here we will see the content of the sample.txt file.
$ cat gfg/sample.txt | pv

Example 3: Display the progression while compressing
To better ensuring we can see the live compression( track compression) using pipe viewer.
$ tar -cf - gfg/* | pv | tar -C . -x

Here it above screenshots show all file content in the specified directory

Explanation: This command is compressing all files which are in gfg/ directory where all flag like -c, -x, etc has a meaning as specified below.
Flags that used in command
- -c: Creates archive
- -x : Extracts the archive
Example 4: Visualize a live ssh network
Using ssh we can connect the host and can see the live connection speed. Here for simplicity, we will direct transfer data to /dev/null.
$ yes | pv | ssh kira@localhost "cat > /dev/null"

Explanation: command can be break in following part to understand
- yes → it gives the permission to connect with the server and can save fingerprint
- pv → for pipe viewer
- ssh kira@localhost → connecting with localhost server
- "cat > /dev/null" → command processing for track progress
Conclusion
The Pipe Viewer (pv) tool is an important utility for Linux Operators who want to handle the progress of long running commands or Information transfers. it provides real-time feedback to help Operators proctor the status of their trading operations Inch Amp Obtuse and Prompt Room. Using pv with common commands like dd cat tar and ssh allows you to visualize the flow of Information between Paths.
Similar Reads
How to List Running Processes in Linux | ps Command As we all know Linux is a multitasking and multi-user system. So, it allows multiple processes to operate simultaneously without interfering with each other. Process is one of the important fundamental concepts of the Linux OS. A process is an executing instance of a program that carries out differe
10 min read
Interesting Funny Commands in Linux This entire article is all about showing off cool commands executable in the Linux terminal. This article is aimed at being a one-stop destination for all cool or you can say interesting funny commands in Linux to play.1. The Matrix Effect: We all can agree on one thing that the falling down text ef
4 min read
pstree Command in Linux with Examples The pstree command in Linux is a powerful tool that displays running processes as a tree structure. This visual representation makes it easier to understand the hierarchy of processes, providing a more intuitive view of how processes are related to each other. The root of the tree is either the `ini
3 min read
How to View the Content of File in Linux | cat Command The cat command in Linux is more than just a simple tool, it's a versatile companion for various file-related operations, allowing users to view, concatenate, create, copy, merge, and manipulate file contents. Let's see the details of some frequently used cat commands, understanding each example alo
7 min read
How to Monitor Linux Commands Executed by System Users in Real-time? If you are a Linux system administrator then you would definitely want to monitor the interactive activity of all system users, like monitoring the Linux commands they execute in real-time. In this brief Linux system security article, we will be going to discuss how to monitor all Linux shell comman
1 min read
GRV - Tool for Viewing Git Repositories in Linux Terminal Git Repository Viewer or GRV is a cross-platform, free, and open-source GIT GUI client. It provides a terminal-based interface to search and view refs, commits, branches, tags, and diffs in a git repository. The behavior and style can be customized through a configuration file. GRV is written in the
2 min read
printf command in Linux with Examples The 'printf' command in Linux is a versatile tool used to display formatted text, numbers, or other data types directly in the terminal. Like the 'printf' function in programming languages like C, the Linux printf command allows users to format output with great precision, making it ideal for script
4 min read
users command in Linux with Examples users command in Linux system is used to show the user names of users currently logged in to the current host. It will display who is currently logged in according to FILE. If the FILE is not specified, use "/var/run/utmp". "/var/log/wtmp" as FILE is common. Syntaxusers [OPTION]... [FILE]where,OPTIO
2 min read
Pipes and Filters in Linux/Unix Pipes in UNIX The novel idea of Pipes was introduced by M.D Mcllroy in June 1972- version 2, 10 UNIX installations. Piping is used to give the output of one command (written on LHS) as input to another command (written on RHS). Commands are piped together using vertical bar " | " symbol. Syntax: com
2 min read
more command in Linux with Examples The 'more' command in Linux is a useful tool for viewing text files in the command prompt, particularly when dealing with large files like log files. It displays the content one screen at a time, allowing users to scroll through the text easily. This command is especially handy for reviewing long ou
3 min read