How To Check The Progress Of Your Commands With The ‘cv’ Utility

As a Linux user you deal with many different commands during the work on a system such as copying file with the cp command, extracting .tar archives with the tar utility, moving files with the mv command and even convert and converting and copying files with the dd utility. The progress of a command is very important to you as you need to get your job done and also want to know how the utility is performing when using it.

Is my movie copied from Downloads to Desktop? Yes we know that the cp command can be used to copy a file, but this command does not show a progress bar for the user to know how the process of copying the file is going.

A very nice and easy solution to implement is the cv tool which is known as the Coreutils Viewer. It is very fast as it is coded in the C programming language. According to the official documentation on github this linux command looks for basic built-in commands currently running on your system such as mv, cp, dd, tar,unzip etc and displays the percentage of copied data.

Even though it is Linux specific a mac port is available.

How to install cv on your Linux system

Installing the cv utility on a Linux system is very easy. The only dependency you have to take care is the library ‘ncurses’ which comes installed by default on many Linux systems.

Ubuntu users can install ncurses using the following command.

sudo apt-get install ncurses-dev

If you use Fedora as your operating system then you will need to run the following command in order  to properly install the library ncurses on your system.

sudo yum install ncurses-devel

CentOS users can install ncurses through yum using the following command.

sudo yum install ncurses-devel

Once you have finished taking care of package dependencies just use the following command to download the source code from github.

wget https://github.com/Xfennec/cv/archive/master.zip

Then use the unzip utility to unzip the file like shown below.

unzip master.zip

Change directory using the cd command.

cd cv-master

Compile and install the cv utility using the two commands shown below.

sudo make
sudo make install

How to use the cv utility

Once the installation of the cv utility is finished you can launch it using the following command.

cv

Running the above command on my system shows the following output.

[ 2796] cat inactive/flushing/streaming/...
[ 2847] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB)
[ 2848] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB)

Now let me copy a movie from my MOVIE directory to Desktop and see what happens when running the cv utility.

cp -r "Troy/" /home/oltjano/Desktop

Running the cv command gives me information on the progress of copying.

[ 7545] cp /home/oltjano/Desktop/MOVIES/Troy/Troy.mp4 6.1% (176.7 MiB / 2.8 GiB)
[ 2847] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB)
[ 2848] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB)

Running cv again.

[ 7545] cp /home/oltjano/Desktop/MOVIES/Troy/Troy.mp4 17.8% (516.5 MiB / 2.8 GiB)
[ 2847] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB)
[ 2848] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB)

As you can see from the above output the cv utility is giving me information on copying process showing me the percentage of the file being copied and also the entire size of the file which is being copied. This is very useful when copying big files: for example when copying a movie and you want to see how much ‘time’ is going to take to get your movie where you want it to be.

There are many useful options you can use while working with the cv Linux utility. One of them is the option -w which gives the user information on the remaining time of an operation: for example this option is very useful when copying large files like we did above with our movie.

Let me run the following command now while copying a movie to my Desktop.

cv -w

The following output is displayed on my console.

[ 2796] cat inactive/flushing/streaming/...
[ 7642] cp /home/oltjano/Desktop/MOVIES/Troy/Troy.mp4 6.7% (195.5 MiB / 2.8 GiB) 1.2 MiB/s eta 0:36:07
[ 2847] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB) 0/s
[ 2848] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB) 0/s

Running it again.

[ 2796] cat inactive/flushing/streaming/...
[ 7642] cp /home/oltjano/Desktop/MOVIES/Troy/Troy.mp4 28.8% (835.1 MiB / 2.8 GiB) 14.5 MiB/s eta 0:02:22
[ 2847] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB) 0/s
[ 2848] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB) 0/s

Running the cv -w command again on my system tells me there is 31 seconds left for my file to get copied.

[ 2796] cat inactive/flushing/streaming/...
[ 7642] cp /home/oltjano/Desktop/MOVIES/Troy/Troy.mp4 54.2% (1.5 GiB / 2.8 GiB) 42.2 MiB/s eta 0:00:31
[ 2847] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB) 0/s
[ 2848] cat /home/oltjano/.xsession-errors 100.0% (1.8 MiB / 1.8 MiB) 0/s

In case you want to run quiet without showing any message use the -q option. But if you want to show all warning/error messages use the -d opition.

For example a good usage of of the cv utility would be like shown below.

cv -wd

You can also loop while monitored processes are running by using the -m option like shown in the following example.

cv -m

The following is a screenshot which is taken on my system after running the above command.

If you want to monitor the progress of your core utilities and never stop then run the following command.

cv -M

The equivalent of the above command is shown below.

watch cv

A very useful combination of options that I like is shown below.

cv -wM

When running the above command I get an idea of a real progress bar.

The equivalent of the above combination is the following.

watch cv -w

There are many other different ways in which you can find the cv linux utility very useful while working on the command line. If you want to see how your download is progressing then use the following command.

watch cv -wc firefox

You can also look at your Web server activity by using the following command.

cv -c httpd

Get help

Getting help when learning and using a new utility is very important. To get help while learning how to use the cv uility run the following command.

cv -h

It will display the following output on your console.

 cv - Coreutils Viewer
 ---------------------
 Shows running coreutils basic commands and displays stats.
 Supported commands: cp mv dd tar gzip gunzip cat grep fgrep egrep cut sort xz md5sum sha1sum sha224sum sha256sum sha384sum sha512sum adb
 Usage: cv [-qdwmM] [-W secs] [-c command] [-p pid]
 -q --quiet hides all messages
 -d --debug shows all warning/error messages
 -w --wait estimate I/O throughput and ETA (slower display)
 -W --wait-delay secs wait 'secs' seconds for I/O estimation (implies -w, default=1.0)
 -m --monitor loop while monitored processes are still running
 -M --monitor-continous like monitor but never stop (similar to watch cv)
 -c --command cmd monitor only this command name (ex: firefox)
 -p --pid id monitor only this process ID (ex: `pidof firefox`)
 -v --version show program version and exit
 -h --help display this help and exit

To get more detailed information and examples use the man command like shown below.

man cv

Conclusion

Being a power Linux user takes alot of passion and work on the command line. Basically everything we do happens on the terminal from copying files to unzipping and extracting tar archives. In this detailed tutorial we took a look at the cv utility which can be used as a great tool when we need information on the progress of basic commands running on our system.

I always like to know the percentage of copied data when dealing with large files. And to be honest I deal with big files alot especially when watching movies on my Ubuntu laptop.

To show the percentage of copied data while using cp I just use the cv utility. Easy as that! Why don’t you install this great useful tool on your system and give it a try?

I bet you never regret trying it!