How to install Advanced Copy Command to Show the Progress Bar in Linux
To install Advanced Copy Command to Show the Progress Bar While Copying Large Files/Folders in Linux
Advanced Copy Command is a powerful command line program that is very much similar to the original cp command. This modified version of cp command adds a progress bar with the total time taken while copying the large files from one location to another and this gives an idea to user about the status of copy process and how long it takes to complete. Installation of Advanced copy command is explained in this article.
To Download and Install Advanced-Copy command
Two methods are used to install Advanced-Copy command in Linux systems, either compile from the sources or using pre-compiled binaries.
Installing from the pre-compiled binaries is the most recommended method.
To Compile from Sources
Download the latest version of GNU coreutils and patchfile, then compile and patch it as given below. Perform all commands as root user.
[root@linuxhelp ~]# wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.21.tar.xz --2016-05-31 18:40:59-- http://ftp.gnu.org/gnu/coreutils/coreutils-8.21.tar.xz Resolving ftp.gnu.org (ftp.gnu.org)... 208.118.235.20, 2001:4830:134:3::b Connecting to ftp.gnu.org (ftp.gnu.org)|208.118.235.20|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 5357988 (5.1M) [application/x-tar] Saving to: ‘ coreutils-8.21.tar.xz’ 100%[==================================================================================================> ] 5,357,988 223KB/s in 29s 2016-05-31 18:41:29 (180 KB/s) - ‘ coreutils-8.21.tar.xz’ saved [5357988/5357988] [root@linuxhelp ~]# ls anaconda-ks.cfg coreutils-8.21.tar.xz Desktop Documents Downloads initial-setup-ks.cfg Music Pictures Public Templates Videos
Extract the source file using the following command.
[root@linuxhelp ~]# tar -xvJf coreutils-8.21.tar.xz
coreutils-8.21/
coreutils-8.21/.version
coreutils-8.21/.vg-suppressions
coreutils-8.21/COPYING
coreutils-8.21/bootstrap
coreutils-8.21/bootstrap.conf
.
.
.
coreutils-8.21/lib/wctype.in.h
coreutils-8.21/lib/uniwidth.in.h
coreutils-8.21/lib/memchr.c
coreutils-8.21/lib/hash-triple.c
coreutils-8.21/lib/strtoul.c
coreutils-8.21/lib/frexp.c
coreutils-8.21/lib/areadlink.h
coreutils-8.21/lib/c-strcase.h
coreutils-8.21/lib/parse-datetime.y
Move to the extracted directory and download the patch file.
[root@linuxhelp ~]# cd coreutils-8.21/ [root@linuxhelp coreutils-8.21]# wget https://raw.githubusercontent.com/atdt/advcpmv/master/advcpmv-0.5-8.21.patch --2016-05-31 18:48:49-- https://raw.githubusercontent.com/atdt/advcpmv/master/advcpmv-0.5-8.21.patch Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 19903 (19K) [text/plain] Saving to: ‘ advcpmv-0.5-8.21.patch’ 100%[==================================================================================================> ] 19,903 --.-K/s in 0.07s 2016-05-31 18:48:50 (289 KB/s) - ‘ advcpmv-0.5-8.21.patch’ saved [19903/19903] [root@linuxhelp coreutils-8.21]# ls ABOUT-NLS bootstrap.conf ChangeLog-2006 COPYING init.cfg Makefile.am po thanks-gen aclocal.m4 build-aux ChangeLog-2007 dist-check.mk INSTALL Makefile.in README THANKS.in advcpmv-0.5-8.21.patch cfg.mk ChangeLog-2008 doc lib man src THANKS-to-translators AUTHORS ChangeLog configure gnulib-tests m4 NEWS tests THANKStt.in bootstrap ChangeLog-2005 configure.ac GNUmakefile maint.mk old THANKS TODO
Execute the following command to install patch command.
[root@linuxhelp coreutils-8.21]# yum install patch -y
BDB2053 Freeing read locks for locker 0x35bb: 11720/140032238479168
BDB2053 Freeing read locks for locker 0x35bd: 11720/140032238479168
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* extras: centos.excellmedia.net
* updates: centosi3.centos.org
Resolving Dependencies
--> Running transaction check
.
.
.
Running transaction
Installing : patch-2.7.1-8.el7.x86_64 1/1
Verifying : patch-2.7.1-8.el7.x86_64 1/1
Installed:
patch.x86_64 0:2.7.1-8.el7
Complete!
Now patch the file.
[root@linuxhelp coreutils-8.21]# patch -p1 -i advcpmv-0.5-8.21.patch
patching file src/copy.c
patching file src/copy.h
patching file src/cp.c
patching file src/mv.c
Run the following command to avoid errors while configuring.
[root@linuxhelp coreutils-8.21]# export FORCE_UNSAFE_CONFIGURE=1 And install required gcc package. [root@linuxhelp coreutils-8.21]# yum install gcc -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile . . . Installed: gcc.x86_64 0:4.8.5-4.el7 Dependency Installed: cpp.x86_64 0:4.8.5-4.el7 glibc-devel.x86_64 0:2.17-106.el7_2.6 glibc-headers.x86_64 0:2.17-106.el7_2.6 kernel-headers.x86_64 0:3.10.0-327.18.2.el7 libmpc.x86_64 0:1.0.1-3.el7 Dependency Updated: glibc.x86_64 0:2.17-106.el7_2.6 glibc-common.x86_64 0:2.17-106.el7_2.6 libgcc.x86_64 0:4.8.5-4.el7 libgomp.x86_64 0:4.8.5-4.el7 Complete!
Now run " ./configure" command.
[root@linuxhelp coreutils-8.21]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
.
.
.
config.status: creating lib/config.h
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
Execute “ make” command.
[root@linuxhelp coreutils-8.21]# make
GEN lib/alloca.h
GEN lib/c++defs.h
GEN lib/warn-on-use.h
GEN lib/arg-nonnull.h
GEN lib/arpa/inet.h
.
.
.
make all-recursive
make[3]: Entering directory `/root/coreutils-8.21/gnulib-tests'
Making all in .
make[4]: Entering directory `/root/coreutils-8.21/gnulib-tests'
make[4]: Nothing to be done for `all-am' .
make[4]: Leaving directory `/root/coreutils-8.21/gnulib-tests'
make[3]: Leaving directory `/root/coreutils-8.21/gnulib-tests'
make[2]: Leaving directory `/root/coreutils-8.21/gnulib-tests'
make[1]: Leaving directory `/root/coreutils-8.21'
After completing the compilation process, we need to create two new files cp and mv under /root/coreutils-8.21/src/. Now we need to copy these two files with the original files, located in /usr/local/bin/
[root@linuxhelp coreutils-8.21]# cp src/cp /usr/local/bin/cp
[root@linuxhelp coreutils-8.21]# cp src/mv /usr/local/bin/mv
To activate the progress bar, open the .bashrc file.
[root@linuxhelp coreutils-8.21]# cd [root@linuxhelp ~]# vim .bashrc
Add the following entries into the file.
alias cp=' cp -gR' alias mv=' mv -g'
Then Restart your system.
Now use the advanced copy command as a normal cp command and specify the required option to view the progress bar while copying the data. We can use the &ndash g or --progress-bar option to view the progress bar.
[root@linuxhelp ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 18G 3.9G 14G 22% / devtmpfs 486M 0 486M 0% /dev tmpfs 494M 84K 494M 1% /dev/shm tmpfs 494M 7.1M 487M 2% /run tmpfs 494M 0 494M 0% /sys/fs/cgroup /dev/sda1 497M 117M 381M 24% /boot /dev/sr0 3.9G 3.9G 0 100% /run/media/root/CentOS 7 x86_64 [root@linuxhelp ~]# mkdir /dvd [root@linuxhelp ~]# cp -gR /run/media/root/CentOS 7 x86_64/ /dvd 234 files copied so far... 330.1 MiB / 3.9 GiB [|||||||||||------------------------------------------------------------------------------------------------------------------------] 8.2 % Copying at 22.7 MiB/s (about 0h 5m 2s remaining) /run/media/root/CentOS 7 x86_64/LiveOS/squashfs.img 178.5 MiB / 278.7 MiB [||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||-----------------------------------------------] 64.0 %
Comments ( 0 )
No comments available