一个可以显示Linux命令的工具


一个可以显示Linux命令的工具


1.Centos7.7 Minimal

2.Progress工具的github地址:

https://github.com/Xfennec/progress

安 装

Progress工具依赖ncurses库,先安装ncurses-devel然后再编译安装progress

<code>[root@localhost ~]# yum -y install ncurses-devel
[root@localhost ~]# git clone https://github.com/Xfennec/progress
[root@localhost ~]# cd progress/
[root@localhost progress]# make && make install/<code>

运行progress

如果没有命令在运行,那么progress程序将退出并告诉你,没有命令正在运行。

<code>[root@localhost ~]# 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, 7z, 7za, zcat, bzcat, lzcat, split, gpg, or wrong permissions./<code>
一个可以显示Linux命令的工具

使用cp命令复制一个文件,当拷贝一个大文件的时候可以看到进度

<code>[root@localhost ~]# cp -p CentOS-7-x86_64-Minimal-1908.iso /tmp/
# 再打开一个终端,输入progress查看任务进度
[root@localhost ~]# progress/<code>
一个可以显示Linux命令的工具

如果需要知道移动或者复制大文件的剩余时间,可以添加-w选项,隐藏全部消息可以使用-q。

<code>[root@localhost ~]# cp -p CentOS-7-x86_64-Minimal-1908.iso /tmp/
# 再打开一个终端,输入progress查看任务进度

[root@localhost ~]# progress -wq/<code>
一个可以显示Linux命令的工具

progress和watch命令一起使用

Watch配合progress命令使用,可以实时显示文件传输的进度:

<code>[root@localhost ~]# cp -p CentOS-7-x86_64-Minimal-1908.iso /tmp/
# 再打开一个终端,输入progress查看任务进度
[root@localhost ~]# watch progress -wq/<code>
一个可以显示Linux命令的工具

总 结

progress只需扫描/proc以查找感兴趣的命令,然后查看目录fd和fdinfo以查找打开的文件和查找位置,并报告最大文件的状态。


分享到:


相關文章: