Progress進度查看器是一個簡單的程序,可用於顯示Coreutils命令的進度。它使用來自文件描述符的信息來肯定命令的進度。Progress的優勢在於它能夠與其餘Linux命令一塊兒使用,好比watch。 |
實驗環境html
Centos7.7 Minimallinux
Progress工具的github地址:https://github.com/Xfennec/progressgit
安裝github
Progress工具依賴ncurses庫,先安裝ncurses-devel而後再編譯安裝progresscentos
[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
運行progresside
若是沒有命令在運行,那麼progress程序將退出並告訴你,沒有命令正在運行。工具
[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.
使用cp命令複製一個文件,當拷貝一個大文件的時候能夠看到進度spa
[root@localhost ~]# cp -p CentOS-7-x86_64-Minimal-1908.iso /tmp/ # 再打開一個終端,輸入progress查看任務進度 [root@localhost ~]# progress
若是須要知道移動或者複製大文件的剩餘時間,能夠添加-w選項,隱藏所有消息能夠使用-q。orm
[root@localhost ~]# cp -p CentOS-7-x86_64-Minimal-1908.iso /tmp/ # 再打開一個終端,輸入progress查看任務進度 [root@localhost ~]# progress -wq
progress和watch命令一塊兒使用htm
Watch配合progress命令使用,能夠實時顯示文件傳輸的進度:
[root@localhost ~]# cp -p CentOS-7-x86_64-Minimal-1908.iso /tmp/ # 再打開一個終端,輸入progress查看任務進度 [root@localhost ~]# watch progress -wq
總結
progress只需掃描/proc以查找感興趣的命令,而後查看目錄fd和fdinfo以查找打開的文件和查找位置,並報告最大文件的狀態。
本文原創地址:https://www.linuxprobe.com/linux-progress-tools.html編輯:逄增寶,審覈員:逄增寶