How to add a progress bar to copy and move commands in Linux?

Updated on September 3, 2017

If you are copying or moving bigger file or folder in Linux, then you might want to know the progress of the job. The default copy (cp) and move (mv) commands doesn’t come with a progress bar feature. So while copying or moving any files, you will only see the commands hanging until the requested operation is completed. Today we will see Advanced copy command in linux that will replace the default cp and mv commands to add a progress bar feature.

Disclaimer: Advanced Copy command will replace the existing cp and mv commands, but it still has all the functionalities of default commands. To be on safer side, you should take a backup of these commands.

Step1: Download and compile Advanced Copy command. To do that, you will also need coreutils.

$ wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.21.tar.xz
$ tar xvJf coreutils-8.21.tar.xz
$ cd coreutils-8.21/
$ wget http://zwicke.org/web/advcopy/advcpmv-0.5-8.21.patch
$ patch -p1 -i advcpmv-0.5-8.21.patch
$ ./configure
$ make

Note: Core-Utils is a useful package to add extra functionalities to existing core files on Linux. But you will have to be careful, as they will contain binaries that might replace the core files of Linux. Replace only what you intend to do.

If you are not sure how to uncompress coreutils-8.21.tar.xz. Then read this guide to uncompress it using tar command.

Step 2: After the make is successful, you have to copy and replace ‘cp’ and ‘mv’ commands under ‘src’ directory.

$ ls -l src/cp
$ ls -l src/mv

Step 3: Replace the default ‘cp’ and ‘mv’ commands with the new ones.

$ cp src/cp /bin/cp
$ cp src/mv /bin/mv

Step 4: Run the below command to see the progress bar while copying or moving files.

$ cp -gR gcc32.tar /tmp/

Note: Option ‘R’ is for recursive and -g will show the progress bar.

Advanced Copy Command
Advanced Copy Command
$ mv -g gcc32.tar /tmp/
Advanced move command
Advanced move command

You can set an alias (in ~/.bashrc) to make progress bar appear by default as below,

alias cp='cp -gR'
alias mv='mv -g'

Note: You have to either source ~/.bashrc to read the change immediately or will take effect from next session.

How to install Advanced Copy command from static binaries?

$ wget http://zwicke.org/web/advcopy/advcpmv-0.5-8.21-static.tar.xz
$ tar xvJf advcpmv-0.5-8.21-static.tar.xz

Once extracted, copy and replace the default ‘cp’ and ‘mv’ commands,

$ cp advcpmv-0.5-8.21-static/cp /usr/local/bin/cp
$ cp advcpmv-0.5-8.21-static/mv /usr/local/bin/mv

Advanced copy commands are really useful and will come handy while you copy or move huge files.

Was this article helpful?

Related Articles

Leave a Comment