linux – Rsync显示单个文件的进度

前端之家收集整理的这篇文章主要介绍了linux – Rsync显示单个文件的进度前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用rsync上传/下载一个非常大的文件(20Gb).我知道–progress选项,但它在我的情况下做的只是向我展示结果.

我的问题是在一些不稳定的连接期间 – 我不知道它是否仍在下载/上传或出现问题.有没有办法显示单个文件的进度条?类似于wget默认做的事情?

谢谢!

解决方法

这可能就是你所追求的.
% rsync -avvz --times --stats --checksum --human-readable --acls \
    --itemize-changes --progress \
    --out-format='[%t] [%i] (Last Modified: %M) (bytes: %-10l) %-100n' \
    /usr/include/glib-2.0 my-glib-copy/

交换机细分如下:

> -avvz = archive,verbose x 2,compress
> –times =保留修改时间
> –stats =提供一些文件传输统计信息
> –checksum =基于校验和跳过,而非mod-time&尺寸
> –human-readable =以人类可读格式输出的数字
> –acls =保留ACL(隐含-p)
> –itemize-changes =输出所有更新的更改摘要
> –progress =显示转移期间的进度
> –out-format ='[%t] [%i](上次修改时间:%M)(字节:%-10l)%-100n’

>%t =当前日期时间
>%i =正在更新的内容的逐项清单
>%M =文件的上次修改时间
>%-10l =文件的长度(以字节为单位)(-10表示对齐和精度)
>%-100n =文件名(短格式;在目录上尾随“/”)( – 100表示​​对齐和精度)

注意:有关上述开关的完整详细信息,请参见rsync和rsyncd.conf的手册页.

上面的命令产生以下脚本:

sending incremental file list
delta-transmission disabled for local transfer or --whole-file
[2012/12/23 21:34:46] [cd+++++++++] (Last Modified: 2010/12/19-08:13:31) (bytes: 4096      ) glib-2.0/
[2012/12/23 21:34:46] [>f+++++++++] (Last Modified: 2010/09/30-15:02:30) (bytes: 1511      ) glib-2.0/glib-object.h
       1.51K 100%    0.00kB/s    0:00:00
       1.51K 100%    0.00kB/s    0:00:00 (xfer#1,to-check=181/183)
[2012/12/23 21:34:46] [>f+++++++++] (Last Modified: 2010/09/30-15:02:30) (bytes: 2910      ) glib-2.0/glib.h
       2.91K 100%    2.78MB/s    0:00:00
       2.91K 100%    2.78MB/s    0:00:00 (xfer#2,to-check=180/183)
[2012/12/23 21:34:46] [>f+++++++++] (Last Modified: 2010/09/30-15:02:31) (bytes: 3613      ) glib-2.0/gmodule.h
       3.61K 100%    3.45MB/s    0:00:00
       3.61K 100%    3.45MB/s    0:00:00 (xfer#3,to-check=179/183)
...
...
[2012/12/23 21:34:46] [>f+++++++++] (Last Modified: 2010/09/30-15:02:31) (bytes: 8431      ) glib-2.0/gobject/gvaluecollector.h
       8.43K 100%  141.96kB/s    0:00:00
       8.43K 100%  141.96kB/s    0:00:00 (xfer#178,to-check=1/183)
[2012/12/23 21:34:46] [>f+++++++++] (Last Modified: 2010/09/30-15:02:31) (bytes: 8507      ) glib-2.0/gobject/gvaluetypes.h
       8.51K 100%  143.23kB/s    0:00:00
       8.51K 100%  143.23kB/s    0:00:00 (xfer#179,to-check=0/183)
total: matches=0  hash_hits=0  false_alarms=0 data=1305506

rsync[2996] (sender) heap statistics:
  arena:         540672   (bytes from sbrk)
  ordblks:            3   (chunks not in use)
  smblks:             7
  hblks:              2   (chunks from mmap)
  hblkhd:        401408   (bytes from mmap)
  allmem:        942080   (bytes from sbrk + mmap)
  usmblks:            0
  fsmblks:          592
  uordblks:      404784   (bytes used)
  fordblks:      135888   (bytes free)
  keepcost:      134240   (bytes in releasable chunk)

rsync[2999] (server receiver) heap statistics:
  arena:         286720   (bytes from sbrk)
  ordblks:            2   (chunks not in use)
  smblks:             8
  hblks:              3   (chunks from mmap)
  hblkhd:        667648   (bytes from mmap)
  allmem:        954368   (bytes from sbrk + mmap)
  usmblks:            0
  fsmblks:          672
  uordblks:      174480   (bytes used)
  fordblks:      112240   (bytes free)
  keepcost:      102352   (bytes in releasable chunk)

rsync[2998] (server generator) heap statistics:
  arena:         233472   (bytes from sbrk)
  ordblks:            4   (chunks not in use)
  smblks:             6
  hblks:              2   (chunks from mmap)
  hblkhd:        401408   (bytes from mmap)
  allmem:        634880   (bytes from sbrk + mmap)
  usmblks:            0
  fsmblks:          448
  uordblks:       83152   (bytes used)
  fordblks:      150320   (bytes free)
  keepcost:      131120   (bytes in releasable chunk)

Number of files: 183
Number of files transferred: 179
Total file size: 1.31M bytes
Total transferred file size: 1.31M bytes
Literal data: 1.31M bytes
Matched data: 0 bytes
File list size: 6.30K
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 350.39K
Total bytes received: 3.43K

sent 350.39K bytes  received 3.43K bytes  707.64K bytes/sec
total size is 1.31M  speedup is 3.69

更新版本的rsync中的进度条?

我遇到了这个SF问题:

> Showing total progress in rsync: is it possible?

One of the answers提到在较新版本的rsync中,现在支持进度条.它看起来像这样:

% ./rsync -a --info=progress2 /usr .
    305,002,533  80%   65.69MB/s    0:00:01  xfr#1653,ir-chk=1593/3594)

此进度条仍然不会显示传输中单个文件的状态,但它确实显示了可能有用的整体传输的百分比.

原文链接:https://www.f2er.com/linux/402267.html

猜你在找的Linux相关文章