v1ral_ITS

pv notes [watching progress of terminal cmds]

Apr 11th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.49 KB | None | 0 0
  1.        pv  will  copy each supplied FILE in turn to standard output (- means standard input), or if no FILEs are specified just standard input is copied. This is the same be‐
  2.        haviour as cat(1).
  3.  
  4.        A simple example to watch how quickly a file is transferred using nc(1):
  5.  
  6.               pv file | nc -w 1 somewhere.com 3000
  7.  
  8.        A similar example, transferring a file from another process and passing the expected size to pv:
  9.  
  10.               cat file | pv -s 12345 | nc -w 1 somewhere.com 3000
  11.  
  12.        A more complicated example using numeric output to feed into the dialog(1) program for a full-screen progress display:
  13.  
  14.               (tar cf - . \
  15.                | pv -n -s $(du -sb . | awk '{print $1}') \
  16.                | gzip -9 > out.tgz) 2>&1 \
  17.               | dialog --gauge 'Progress' 7 70
  18.  
  19.        Taking an image of a disk, skipping errors:
  20.  
  21.               pv -EE /dev/sda > disk-image.img
  22.  
  23.        Writing an image back to a disk:
  24.  
  25.               pv disk-image.img > /dev/sda
  26.  
  27.        Zeroing a disk:
  28.  
  29.               pv < /dev/zero > /dev/sda
  30.  
  31.        Note that if the input size cannot be calculated, and the output is a block device, then the size of the block device will be used and pv will  automatically  stop  at
  32.        that size as if -S had been given.
  33.  
  34.        (Linux only): Watching file descriptor 3 opened by another process 1234:
  35.  
  36.               pv -d 1234:3
  37.  
  38.        (Linux only): Watching all file descriptors used by process 1234:
  39.  
  40.               pv -d 1234
Add Comment
Please, Sign In to add comment