Method for monitoring Linux command completion using PV commands

  
                

Linux system administrators need to perform real-time monitoring of commands so that they know that the commands have been executed successfully, rather than being suspended. Here's how to use the PV command to monitor the completion of Linux commands.

Linux command does not usually progress and provide relevant information, and this information is particularly important, especially when you have limited time. However, this does not mean that you are helpless —— now there is a command, pv, which displays the progress of the command currently executing on the command line. We will discuss it in this article and illustrate its features with a few simple examples.

PV Commands

PV Developed by Andrew Wood, short for Pipe Viewer, which means to display information about the progress of data processing through pipes. This information includes the time that has been spent, the percentage of completion (shown by the progress bar), the current speed, the total transmitted data, and the estimated time remaining.

<;To use PV, you need to fit the appropriate options and place it in the pipeline between the two processes. The standard input of the command will be passed in via the standard output, and the progress will be output to the standard error output. ” The above explanation comes from the help page for the command.

Download and Install

Debian-based operating systems, such as Ubuntu, can simply install PV using the following command:

sudo apt-get install pv

If you are using other distributions, you can install PV on your system using the respective package management software. Once the PV is installed you can use it in a variety of situations (see below). Note that all the examples below use pv 1.2.0.

Features and Usages

Most of the usage scenarios we use (users who use the command line on linux) use commands that copy movie files from a USB drive to your computer. If you use cp to accomplish the above tasks, you will not know what is going on until the entire copying process ends or an error occurs.

However, the pv command is very helpful in this scenario. For example:

pv /media/himanshu/1AC2-A8E3/fNf.mkv & gt; ./Desktop/fnf.mkv

Output follows:

pv- Copy So, as you can see, this command shows a lot of useful information about the operation, including the amount of data that has been transferred, the time it took, the transfer rate, the progress bar, the percentage of progress, and the time remaining.

The pv command provides a variety of display option switches. For example, you can use -p to display the percentage, -t to display the time, -r to indicate the transfer rate, and -e to represent eta (LCTT). The good thing is that you don't have to remember one option, because the default options are enabled. However, if you only need one of these information, you can complete the task by controlling these options.

Previous 12 Next Total 2 Pages

Copyright © Windows knowledge All Rights Reserved