Did You Know?
Donate to TecMint

We are pleased to announce our new TecMint Q/A section to submit your Linux questions

Advanced Copy Command – Shows Progress Bar While Copying Large Files/Folders in Linux

Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators

Advanced-Copy is a powerful command line program which is very much similar, but little modified version of original cp command. This modified version of cp command adds a progress bar along with total time taken to complete, while copying large files from one location to another. This additional feature is very useful especially while copying large files, and this gives an idea to user about the status of copy process and how long it takes to complete.

Advanced Copy Command Tool

Download and Install Advanced-Copy

There are two methods to install Advanced-Copy utility in Linux systems, either you compile from sources or using pre-compiled binaries. Installing from pre-compiled binaries should always work correctly and requires lesser experience and very effective for Linux newbies.

But I suggest you to compile from sources, for this you required original version of GNU coreutils and latest patchfile of Advacned-Copy. The whole installation should go like this:

Method 1: Compiling from Sources

First, download the latest version of GNU coreutils and patchfile using wget command and compile and patch it as shown below, you must be root user to perform all commands.

# 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

You might get the following error, while running “./configure” command.

checking whether mknod can create fifo without root privileges... configure: error: in `/home/tecmint/coreutils-8.21':
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details

Run the following command on the terminal to fix that error and run the “./configure” command again.

export FORCE_UNSAFE_CONFIGURE=1

Once, compilation completes, two new commands are created under src/cp and src/mv. You need to replace your original cp and mv commands with these two new commands to get the progress bar while copying files.

# cp src/cp /usr/local/bin/cp
# cp src/mv /usr/local/bin/mv
Method 2: Installing from Pre-compiled Binaries

Instead of compiling from sources, you should download pre-compiled binaries for your Linux systems using following wget command.

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

After extracting, two new programs are created inside the advcpmv-0.5-8.21-static directory. Replace these two command with original 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

Note: If you don’t want to copy these commands under standard system paths, you can still run them from source directory like “./cp” and “./mv“.

Automatic progress bar

If you want the progress bar to be appear all the time while copying, you need to add the following lines to your ~/.bashrc file. Save and close the file

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

You need to logout and login again to get this work correctly.

How to Use Advacned-Copy Command

The command is same, the only change is adding “-g” or “–progress-bar” option with cp command. The “-R” option is for copying directories recursively. Here is an example screen-shots of a copy process using advanced copy command.

# cp -gR /Tecmint.com/ /data/

OR

# cp -R --progress-bar /Tecmint.com/ /data/

Advanced Copy Command

Advanced Copy Command

Here is the example of ‘mv‘ command with screen-shot.

# mv --progress-bar Songs/ /data/

OR

# mv -g Songs/ /data/

Advanced Mv Command

Please remember, original commands are not overwritten, if you ever need to use them or you’re not happy with the new progress bar, and want to revert back to original cp and mv commands. You can call them via /usr/bin/cp or /usr/bin/mv.

I really much impressed with this new progress bar feature, at least I would know some information of copy operation time and exactly what’s going on.

Overall I can say, it is really good tool to have in your pocket, especially when you are spending lots of time in copying and moving files through command line.

Ravi Saive

Owner at TecMint.com
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Linux Services & Free WordPress Setup

Our post is simply ‘DIY’ aka ‘Do It Yourself, still you may find difficulties and want us to help you out. We offer wide range of Linux and Web Hosting Solutions at fair minimum rates. Please submit your orders by Clicking Here.

10 Responses

  1. Eddie says:

    I always use for this “rsync –progress” really simple

  2. n2 says:

    I don’t log out every time i add a new alias, I just type:

    source ~/.bashrc

    and it’s ready for use :)

  3. AndrewM says:

    You could also just use scp with localhost.

  4. krisinho says:

    you could always create simple aliases for rsync:

    alias rcopy=”rsync –partial –progress –append –rsh=ssh -r -h”
    alias rmove=”rsync –partial –progress –append –rsh=ssh -r -h –remove-sent-files”

    works great:)

  5. monsterz says:

    This thing always result in segmentation fault after 3~4 GB of data copied, using pre-compiled binaries, on Ubuntu 13.04.

  6. giovane says:

    thanks!!!!

  7. DEEPAK says:

    Is there any malware patch in this ?

  8. DEEPAK says:

    [root@DEEPAKPC coreutils-8.21]# cp src/cp /usr/bin/
    cp: overwrite ‘/usr/bin/cp’? y
    cp: cannot create regular file ‘/usr/bin/cp’: Text file busy

    • Ravi Saive says:

      I think something is preventing your from overwriting the file, so better use -f flag, it will force you to copy file. like

      cp -f src/cp /usr/bin/
      

Leave a Reply

This work is licensed under a (cc) BY-NC | TecMint uses cookies. By using our services, you comply to use of our cookies. More info: Privacy Policy.
© 2012-2014 All Rights Reserved.