
linux 命令pv
When copying, moving files or making backups if the operation requires long time we want to know the progress of the operation. By default most of the Linux tools do not provide this ability by native . pv
command is an auxiliary tool used to implement the progress bar about the pipe or operation. Pv command can provide following information
当复制,移动文件或进行备份(如果操作需要很长时间)时,我们想知道操作的进度。 默认情况下,大多数Linux工具都不通过本机提供此功能。 pv
命令是辅助工具,用于实现有关管道或操作的进度条。 光伏指令可以提供以下信息
- Time elapsed时间流逝
- Completion percentage完成百分比
- Remaining Percentage剩余百分比
- Total data transferred传输的总数据
- Estimated Time Remaining预计剩余时间
简单用法(Simple Usage)
As stated previously pv command will monitor the pipeline or copy operation. We will copy test.deb
as test2.deb
and monitor copy process by piping it.
如前所述,pv命令将监视管道或复制操作。 我们将test.deb
复制为test2.deb
并通过管道监控复制过程。
$ cp test.deb test2.deb | pv

仅显示显示栏(Show Only Display Bar)
We can only show the bar. This will hide all other information.
我们只能显示酒吧。 这将隐藏所有其他信息。
$ cp test.deb test2.deb | pv -p

仅显示经过的时间(Show Only Elapsed Time)
We can only show the elapsed timer. This will hide all other information.
我们只能显示经过的计时器。 这将隐藏所有其他信息。
$ cp test.deb test2.deb | pv --timer

仅显示预计到达时间(Show Only ETA)
Tracking estimated time is important.We can show ETA with the --eta
option like below.
跟踪估计的时间很重要,我们可以使用--eta
选项显示ETA,如下所示。
$ cp test.deb test2.deb | pv --eta
显示率 (Show Rate)
We can only show the rate. This will hide all other information.
我们只能显示汇率。 这将隐藏所有其他信息。
$ cp test.deb test2.deb | pv --rate

仅显示传输的数据大小(Show Only Transferred Data Size)
We can only show the transferred data size. This will hide all other information.
我们只能显示传输的数据大小。 这将隐藏所有其他信息。
$ cp test.deb test2.deb | pv --bytes
刷新指定间隔 (Refresh Specified Interval)
While showing statistics there will be some information refresh. This refresh interval can be specified with -i
. In the example we set refresh interval time as 2 seconds.
显示统计信息时,将刷新一些信息。 可以使用-i
指定此刷新间隔。 在示例中,我们将刷新间隔时间设置为2秒。
$ cp test.deb test2.deb | pv -i 2
版 (Version)
Version of the pv command can be shown with --version
option like below.
可以使用--version
选项显示pv命令的版本,如下所示。
$ pv --version

翻译自: https://www.poftut.com/linux-pv-command-tutorial-examples-monitor-progress-copybackupcompress/
linux 命令pv