我使用 Ubuntu 12.04 作为存储库,并希望rsync
在从命令行使用时查看进度条。我尝试了本文( -P
) 中建议的选项,但我更喜欢查看进度条而不是使用 Grsync。我rsync -P source dest
目前正在使用。
Jon*_*Jon 71
rsync 有一个--info
选项,不仅可以用来输出当前的进度,还可以输出传输速率和经过的时间:
--info=FLAGS fine-grained informational verbosity
Run Code Online (Sandbox Code Playgroud)
如何使用它的解释来自-P
手册页中的选项:
-P The -P option is equivalent to --partial --progress. Its purpose is to
make it much easier to specify these two options for a long transfer that
may be interrupted.
There is also a --info=progress2 option that outputs statistics based on
the whole transfer, rather than individual files. Use this flag
without out?putting a filename (e.g. avoid -v or specify --info=name0)
if you want to see how the transfer is doing without scrolling the screen
with a lot of names. (You don’t need to specify the --progress
option in order to use --info=progress2.)
Run Code Online (Sandbox Code Playgroud)
所以如下:
rsync -r --info=progress2 --info=name0 "$src" "$dst"
Run Code Online (Sandbox Code Playgroud)
结果输出如下并不断更新:
18,757,542,664 100% 65.70MB/s 0:04:32 (xfr#1389, to-chk=0/1510)
Run Code Online (Sandbox Code Playgroud)
请注意,当传输开始时,块的总数以及当前的进度会在使用递归选项时更改,因为发现更多文件进行同步
fug*_*ive 26
您可以使用--progress
和--stats
参数。
rsync -avzh --progress --stats root@server:/path/to/file output_name
root@server's password:
receiving incremental file list
file
98.19M 54% 8.99MB/s 0:00:08
Run Code Online (Sandbox Code Playgroud)
A.B*_*.B. 13
这个怎么样?
rsync_param="-av"
rsync "$rsync_param" a/ b |\
pv -lep -s $(rsync "$rsync_param"n a/ b | awk 'NF' | wc -l)
Run Code Online (Sandbox Code Playgroud)
$rsync_param
避免参数的双重输入
$(rsync "$rsync_param"n a/ b | awk 'NF' | wc -l)
确定要完成的步骤数。
a/ b
a/
是来源b
是目标