Alternatives to Linux CP to Show Progress and Speed

In Linux, we use the “cp” or “ditto” command for copying the files from one directory to another. Sometimes using the cp command can be time-consuming for the user because it does not display the speed or any progress bar. You can use the “v” flag for the verbose mode to display more copy information, but there will be no progress bar.

Is there any alternative method for displaying the progress bar while copying the files? Yes! Linux provides various methods for copying the file with the speed and the progress bar.

This article will demonstrate the alternatives of the cp command to show progress and speed in Linux. The content for the post is as:

Method 1: Show Progress and Speed While Copying Through rsync Utility

In Linux, copying the files can be done through the “rsync” utility. The rsync is the built-in network-enabled utility that lets users sync the directories and files. It provides the facility for displaying the progress of each file being copied. Users can use the “av” option in the “rsync” command. The “a” option is used for the archive mode, and the “v” option to run the command in the verbose mode. Let’s copy the files from “Source_Directory” to the “Destination_Directory”:

$ rsync -av --progress Source_Directory/ Destination_Directory/

The “progress” will display the overall progress of the copied files.

Users can also use the “stats” flag to display more detailed information:

$ rsync -av --progress --stats Source_Directory/ Destination_Directory/

The above image shows more details about the copy.

Method 2: Show Progress and Speed While Copying Through pv Utility

The second way to show the progress bar and speed of the copying is to use the “pv” utility. The “pv” is the utility used for tracking the information of data being transferred. To install the “pv” utility, use the following command:

For Debian/Ubuntu:

$ sudo apt install pv

The “pv” command will be installed.

For Fedora/CentOS/RHEL:

$ sudo yum install pv

Let’s copy the file using the pv command. We have one pdf file, “itslinuxfoss.pdf,” that will be copied to the “outputfile” using the redirection operator:

$ pv itslinuxfoss.pdf > outputfile

The file has been copied to the “outputfile” with the progress bar and speed.

Method 3: Show Progress and Speed While Copying Through tar Utility

Another method to show the progress and speed is to use the “tar” command with a combination of the “pv” to show the progress bar and speed. Give the source directory in the first command, “pv” in the second command, and the destination directory in the third command:

$ tar c Source_Directory | pv | tar x -C Destination_Directory

The files of the source directory will be copied to the destination directory with the progress bar and speed.

Method 4: Show Progress and Speed While Copying Through dd Utility

The “dd” is the utility for converting or copying the files available in all Linux distributions. Users can use the below command for copying the files, giving the name of the source file in the “if” and the destination address in the “of”. Then add the “status=progress” for showing the progress bar:

$ sudo dd if=itslinuxfoss.pdf of=/Destination_Directory status=progress

The file has been copied with the speed of 2.9MB/s.

Conclusion

In Linux, for using the alternative of the cp command to show the progress bar and speed, use the “rsync”, “pv”, “tar” or “dd” utility. For using the “pv” command, install it in the operating system using the given command, while other utilities “rsync”, “tar”, and “dd” are the built-in utilities. This write-up has illustrated the alternative methods to show the progress bar and speed while copying.