Linux commands I never knew existed: Pipe Viewer
I have been using linux since about 1995, and it still surprises me how creative the people who contribute code and work on projects are. The other day I had to image a bunch of machines, they all needed to be 100% identical, so I figured I would just use “dd” and send to output over to each slave machine using netcat. For anyone who has ever done this before, it can be a bit hard to figure out how fast data is being sent over to the system being imaged. This is where Pipe Viewer came in handy. Quite simply this app reports the bitrate that the data is sent over a unix pipe. Brilliant.
It is not installed by default in debian, so the following will install the app.
user@slashzero-desktop:~$ sudo aptitude install pv
Once installed, passing the “–help” parameter will list the basic options.
user@slashzero-desktop:~$ pv --help
Usage: pv [OPTION] [FILE]...
Concatenate FILE(s), or standard input, to standard output,
-p, --progress show progress bar
-t, --timer show elapsed time
-e, --eta show estimated time of arrival (completion)
-r, --rate show data transfer rate counter
-b, --bytes show number of bytes transferred
-f, --force output even if standard error is not a terminal
-n, --numeric output percentages, not visual information
-q, --quiet do not output any transfer information at all
-c, --cursor use cursor positioning escape sequences
-W, --wait display nothing until first byte transferred
-s, --size SIZE set estimated data size to SIZE bytes
-l, --line-mode count lines instead of bytes
-i, --interval SEC update every SEC seconds
-w, --width WIDTH assume terminal is WIDTH characters wide
-H, --height HEIGHT assume terminal is HEIGHT rows high
-N, --name NAME prefix visual information with NAME
-L, --rate-limit RATE limit transfer to RATE bytes per second
-B, --buffer-size BYTES use a buffer size of BYTES
-R, --remote PID update settings of process PID
-h, --help show this help and exit
-V, --version show version information and exit
Please report any bugs to Andrew Wood .
And here is a quick example, this command tar’s up a directory and send the output to gzip, showing a rate of 223MB/s:
user@slashzero-desktop:/home$ tar zcf - user | pv /bin/gzip > /tmp/backup.tar.gz
59.7kB 0:00:00 [ 223MB/s] [===========================================>] 100%
Incredibly useful stuff.