红联Linux门户
Linux帮助

progress:显示Linux命令的执行进度

发布时间:2016-10-19 15:37:12来源:topspeedsnail.com作者:斗大的熊猫
progress前用名Coreutils Viewer,是使用C语言开发的,用来显示Linux命令执行进度的工具,支持cp, mv, tar, dd, gzip/gunzip, cat, grep等coreutils基本命令。
progress源代码:https://github.com/Xfennec/progress
 
This tool can be described as a Tiny, Dirty, Linux-and-OSX-Only C command that looks for coreutils basic commands (cp, mv, dd, tar, gzip/gunzip, cat, etc.) currently running on your system and displays the percentage of copied data. It can also show estimated time and throughput, and provides a “top-like” mode (monitoring).
 
其它监控命令执行进度条的工具:
Linux:使用pv命令显示执行进度:http://www.linuxdiyf.com/linux/23543.html
怎么让dd命令显示执行进度?:http://www.linuxdiyf.com/linux/23544.html
 
Linux安装progress
progress依赖libncurses库显示进度条;安装依赖:
# CentOS
yum install ncurses-devel
# Fedora 22
dnf install ncurses-devel
# Ubuntu
sudo apt-get install libncurses5-dev
下载源码,编译安装:
$ git clone  https://github.com/Xfennec/progress
$ cd progress
$ make
$ sudo make install
 
progress的使用
 
查看支持的命令:
$ progress
No command currently running: cp, mv, dd, tar, cat, rsync, grep, fgrep, egrep, cut, sort, md5sum, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, adb, gzip, gunzip, bzip2, bunzip2, xz, unxz, lzma, unlzma, zcat, bzcat, lzcat, or wrong permissions.
首先执行要监控的命令,然后打开另一个终端,运行:
$ progress
# $ progress -w
progress:显示Linux命令的执行进度
progress首先搜索/proc,找到要监控的命令,然后搜索fd和fdinfo目录,找到打开的文件,计算执行进度。详细原理参考源代码。
-m选项:
$ tar czf test.tar.gz /home/snail/ | progress  -m  $!
progress:显示Linux命令的执行进度
监控所有即将要执行的命令:
$ watch progress -q
查看帮助:
$ man progress
 
本文永久更新地址:http://www.linuxdiyf.com/linux/25194.html