pv命令

原来pv命令这么好玩(Simulate typing)

$ echo "You can simulate on-screen typing just like in the movies" | pv -qL 10

commandfu上还有一些pv相关的,大都与进度条相关。

$ pv file1 > file2 #copy文件,并显示进度条

pv的man文档里也有几个有用的例子可以参考。

A simple example to watch how quickly a file is transferred using nc(1):

          pv file | nc -w 1 somewhere.com 3000

A similar example, transferring a file from another process and passing the expected size to pv:

          cat file | pv -s 12345 | nc -w 1 somewhere.com 3000

A more complicated example using numeric output to feed into the dialog(1) program for a full-screen progress display:

          (tar cf - . \
           | pv -n -s $(du -sb . | awk '{print $1}') \
           | gzip -9 > out.tgz) 2>&1 \
          | dialog --gauge 'Progress' 7 70

发表评论

电子邮件地址不会被公开。 必填项已用*标注