一個可以顯示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以查找打開的文件和查找位置,並報告最大文件的狀態。


分享到:


相關文章: