The Wayback Machine - https://web.archive.org/web/20240828164145/https://www.geeksforgeeks.org/viewing-progress-of-commands-using-pipe-viewer-tool-in-linux/
Open In App

Viewing Progress of Commands Using Pipe Viewer Tool in Linux

Last Updated : 17 May, 2021
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Pipe Viewer (pv) is the CLI tool that allows users to track the progress of the process and display them on the terminal by giving information such as total data transferred, the time elapsed, completed percentage, etc. To visualize the process progress it can be used normally via pipe operator b/w processes. 

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

Pipe Viewer A Tool to View Progress of Commands in Linux

Here providing some examples to better understanding and to learn the use of this tool. 

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

Pipe Viewer A Tool to View Progress of Commands in Linux

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

Pipe Viewer A Tool to View Progress of Commands in Linux

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

Pipe Viewer A Tool to View Progress of Commands in Linux

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

Pipe Viewer A Tool to View Progress of Commands in Linux

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"

Pipe Viewer A Tool to View Progress of Commands in Linux

Explanation: command can be break in following part to understand

  1. yes → it gives the permission to connect with the server and can save fingerprint
  2. pv → for pipe viewer
  3. ssh kira@localhost  → connecting with localhost server
  4. “cat > /dev/null” → command processing for track progress


Similar Reads

Progress - Tool to monitor progress of basic command in Linux
Progress is a command-line-based tiny tool which is formerly known as a Coreutils Progress Viewer. This tool is written in the C language. This command looks for the Coreutils basic command like cp, mv, dd, tar, gzip, cat, etc. which are currently running on the system and display the percentage of copied data. This tool can also show the estimated
2 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 Go programming language and is available under GN
2 min read
Viewing typescript .ts files in Midnight Commander
TypeScript is an important and popular framework developed in 2012 that is used in our daily life for the development of various applications. We can simply install any text editor Such as Visual Studio Code or sublime text editor to edit and manage our code files but whenever we are working on Linux or Ubuntu it becomes challenging to open the spe
6 min read
Basic CentOS Linux Commands in linux
CentOS is a free and open-source operating system that aims to provide a stable reliable, and community-supported platform for servers and other enterprise applications. In this article, we will be covering CentOS Linux basics commands and functions of CentOS and also we will look into the advanced commands. These CentOS commands allow you to manag
3 min read
Webkiller v2.0 - Tool Information Gathering tool in Kali Linux
Webkiller is a free and open-source tool available on GitHub. Webkiller is used as an information-gathering tool. Webkiller is used to scan websites for information gathering and finding vulnerabilities in websites and webapps. The whois data collection gives us information about Geoip lookup, Banner grabbing, DNS lookup, port scanning, sub-domain
3 min read
Cewl Tool - Creating Custom Wordlists Tool in Kali Linux
In this article, we will see how to create a wordlist with the Kali Linux tool Cewl and what options are available in this post. Cewl is a Ruby program that crawls a URL to a defined depth, optionally following external links, and produces a list of keywords that password crackers such as John the Ripper can use to crack passwords. can. FAB (Files
4 min read
Tool-X - Hacking Tool Installer in Kali Linux
Tool-X is a free and open-source tool written in python that is available on GitHub. Tool-X is used by security researchers and pen-testers in the early stages of reconnaissance and pen-testing. It is an installer framework for Kali Linux that has approximately 300 tools available on its menu. It will provide a command-line user interface that you
2 min read
How to Install Nomacs Image Viewer on Ubuntu
Nomacs Image Viewer is a free and open-source application that allows users to view, edit, and manage digital images. Application is available on various platforms including Windows, Linux, and MacOS. Nomacs application supports various file formats including JPEG, PNG, TIFF, BMP, and many more. Nomacs application has a simple and user-friendly use
4 min read
List out all the Shells Using Linux Commands
There are various methods to list all the shells which are installed in our Linux system. A Shell is a software program that acts as an interface between the user and the operating system(OS). It can also be thought of as a command interpreter that is used to execute another program. Method 1: Using cat command Example: cat /etc/shells Explanation:
1 min read
How to execute commands remotely using SSH in Linux?
Many times users need to work in remote systems. For which they have to log in to the remote server, execute certain commands and come out of that session. Is it possible to perform all these actions locally? Yes, it's possible using ssh client. In this article, we will see different ways of running remote commands locally using ssh. Pre-requisite
2 min read
Using the eval command in Linux to run variables as commands
In Linux, the eval command serves as a powerful tool, enabling users to execute commands stored within variables. This functionality proves particularly useful for scripting and automation, allowing dynamic generation and execution of commands during runtime. By employing, users can manipulate and run strings as if they were direct commands, offeri
4 min read
How to Access All Users in Linux Using Different Commands?
Linux allows multiple users with their own custom setting and configuration to work together on the same system, even at the same time. It can even allow a particular user to access several sessions from different locations in order to work on the system. Below is a list of different commands to access the list of users in Linux: 1. less command: E
2 min read
Named Pipe or FIFO with example C program
In computing, a named pipe (also known as a FIFO) is one of the methods for inter-process communication. It is an extension to the traditional pipe concept on Unix. A traditional pipe is "unnamed" and lasts only as long as the process.A named pipe, however, can last as long as the system is up, beyond the life of the process. It can be deleted if n
3 min read
Internal and External Commands in Linux
The UNIX system is command-based i.e things happen because of the commands that you key in. All UNIX commands are seldom more than four characters long. They are grouped into two categories: Internal Commands : Commands which are built into the shell. For all the shell built-in commands, execution of the same is fast in the sense that the shell doe
4 min read
Useful and time saving bash commands in Linux
There are many useful bash scripts that can make things easier. Many things can be done just using the terminal. Here is a list of some of such useful bash scripts through which we can do things that cannot be done manually. 1. Counting the number of files(or directory) in a given directory: Go to the directory in which you want to count the number
3 min read
Process Control Commands in Unix/Linux
Process control commands in Unix are: bg - put suspended process into background fg - bring process into foreground jobs - list processes bg Command : bg is a process control command that resumes suspended process while keeping them running in the background. User can run a job in the background by adding a "&amp;" symbol at the end of the command.
3 min read
halt, poweroff and reboot Commands in Linux
Below are typical uses of halt, poweroff and reboot. halt : Instructs hardware to stop CPU functions. poweroff : Instructs the system to power down. reboot : Restarts or reboots the system. The above mentioned commands can only be run by super user as these involve the actions to stop the system hardware. If the user is not logged in as super user
2 min read
Custom commands for linux terminal
Linux operating system allows users to create commands and execute them over the command line. To create a command in Linux, the first step is to create a bash script for the command. The second step is to make the command executable. Syntax : $ nano ~/.bashrc Here, bashrc means run the Bash file. Bash is located at /bin/bash . This file helps in c
2 min read
Fun Commands in Linux
cowsay First we install it using sudo apt-get install cowsay. We use other objects to use -l to list them and -f to use them. xcowsay First, we install it using sudo apt-get install xcowsay. Then here is the way to use it. THE MATRIX Use below command to install it sudo apt-get install cmatrix Once installed, use below command to print. cmatrix To
1 min read
Basic Shell Commands in Linux
A shell is a special user program that provides an interface to the user to use operating system services. Shell accepts human-readable commands from the user and converts them into something which the kernel can understand. It is a command language interpreter that executes commands read from input devices such as keyboards or from files. The shel
3 min read
Python | Execute and parse Linux commands
Prerequisite: Introduction to Linux Shell and Shell Scripting Linux is one of the most popular operating systems and is a common choice for developers. It is popular because it is open source, it's free and customizable, it is very robust and adaptable. An operating system mainly consists of two parts: The kernel and the Shell. The kernel basically
6 min read
How to run Linux Commands on Windows 10?
It is a dilemma when you want to switch from one operating system to another. This is a common case when you switch from Windows to Linux. Either you store your data and then uninstall Windows to install Linux and then transfer your data or you can have a dual boot system where you encounter an option as to which OS to choose in the beginning. Don'
2 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 effect from "The Matrix" movie is one of the best s
5 min read
Deprecated Linux Networking Commands and Their Replacements
In this article, let us have a close look at some networking commands that are deprecated. That means they are not provided by default and replaced by other commands that serve the same purpose. But please note that these commands can still be executed by first downloading the net-tools package onto the machine. sudo apt-get install net-toolsThese
4 min read
Linux vs Windows Commands
Most of us think that Linux has terminal and we can use a command-line interface only in Linux but it is just a myth. There is a PowerShell and a command prompt in windows as well where we may execute the commands easily. But Windows and Linux have commands with the same name as well. .linux-vs-windows-table { border-collapse: collapse; width: 100%
2 min read
How to Build Your Own Commands in Linux?
Linux is one of the most widely used open-source operating systems which supports both GUI as well as CLI. It has been widely used all over the world since its first distribution launched on September 17, 1991, by Linus Torvalds. It is widely known for its command-line operations. We have been using several commands in Linux like date command, mkdi
6 min read
Chaining Commands in Linux
Chaining commands in Linux allows us to execute multiple commands at the same time and directly through the terminal. It's like short shell scripts that can be executed through the terminal directly. Linux command chaining is a technique of merging several commands such that each of them can execute in sequence depending on the operator that separa
7 min read
Most Useful Commands to Manage Apache Web Server in Linux
Prerequisite: How do Web Servers work? Apache is one of the most widely used free, open-source Web Server applications in the world, mostly used in Unix-like operating systems but can also be used in windows. As a developer or system administrator, it will be very helpful for you to know about the Apache webserver. It has many notable features amon
3 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 commands executed by system users in real-time. Let's se
1 min read
Ways to Re-run Last Executed Commands in Linux
It would be quite efficient to re-execute the last command. If the command was quite big to type in again, this would be quite a great trick to improve efficiency. So let us see what the commands are to run the last executed command again in the Linux terminal. The ways to run the last executed command are as follows: Ctrl + PUp Arrow key.bang-bang
3 min read