When you copy a large file in terminal with simple cp command without flags, you might sometimes wonder whether it is really copying or the process got blocked somehow and it will actually never finish. The output is non existent and you are tempted to pres Ctrl-C to end abort the process. Well instead of that, you can download the progress utility in another terminal window and run it to see what the command is actually doing. Progress package supports cp, mv, dd, tar, gzip/gunzip, cat and other basic coreutils commands, and it gives the percentage of completion upon invocation and this would an alternative for pv command.
Install Progress package
For CentOS 6 and 7 (ofcourse for same RHEL) you need to download the progress package with wget as it is not present in EPEL repository nor in base.
yum install progress-0.13-1.el6.x86_64.rpm
For Fedora 24 you can simply install it with yum or dnf, it is present in main repositories.
sudo yum install progress
How to Use progress
As I don’t have any large files on my CentOS 6 VM, I will use Fedora host to test the command. I will just grab any of the large files, then copy it to random directory. For this example, it will be a movie.
Then in another terminal window, lets run progress
I have ran it three times, at various stages of completion of cp command. In the end, GNOME notification shows it has ended the copying process:
Then if I run progress one more time after that it shows following output:
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.
That is the list of commands that progress program can monitor and show progress activity.
Lets next try with dd command
We see here two terminal windows stacked. Top one is seemingly stuck while bottom one shows that top one is not stuck after all. It is doing it’s job because every invocation of progress command is showing increased completion percentage.
Lets try tar command as well.
We don’t necessarily need to invoke progress command multiple times. Instead we can use interactive options.
For example progress -w will give us more detailed view.
[ 6140] cp /home/miki/centos.iso
19.5% (771.5 MiB / 3.9 GiB) 79.2 MiB/s remaining 0:00:40
And watch progress -w will give us interactive update on every 2 seconds about the command completion. For example like this:
Every 2.0s: progress -w Sun Sep 4 13:39:35 2016
[ 6312] cp /home/miki/centos.iso
82.9% (3.2 GiB / 3.9 GiB) 33.9 MiB/s remaining 0:00:19
So if you get stuck with any of those listed commands, now you know what to do. You can use progress to know whether you are really stuck, or just file is too big and takes time. This will hopefully save you some time because you will know whether to wait or cancel some command.