Monday, June 08, 2015

Linux Advanced Copy ( Modified Original cp Command )

Advanced-Copy is a powerful command line program which is modified version of original cp command. This modified version of cp command adds a progress bar and etc. shortly, it's much better than original cp command. How to get advanced copy on Debian "Wheezy" 7.8 .And this step work and tested. Download all required file all in one from HERE
root@prc-04:/tmp# wget https://www.dropbox.com/s/o9rs7o0l0569iv3/coreutils-8.4-receipt.tar.gz?dl=0
root@prc-04:/tmp# mv -v coreutils-8.4-receipt.tar.gz?dl=0 coreutils-8.4-receipt.tar.gz
Extract it
#root@prc-04:/tmp# tar -zxvf coreutils-8.4-receipt.tar.gz
coreutils-8.4.tar.gz
coreutils-8.4.patch
Extract coreutils-8.4.tar.gz
root@prc-04:/tmp# tar -zxvf coreutils-8.4.tar.gz
Copy file pacth
root@prc-04:/tmp# cp -v coreutils-8.4.patch coreutils-8.4/
`coreutils-8.4.patch' ---> `coreutils-8.4/coreutils-8.4.patch'
Go to coreutils-8.4/
root@prc-04:/tmp# cd coreutils-8.4/
root@prc-04:/tmp/coreutils-8.4#
Patch it
root@prc-04:/tmp/coreutils-8.4# patch -p1 -i coreutils-8.4.patch
(Stripping trailing CRs from patch.)patching file src/copy.c
(Stripping trailing CRs from patch.)patching file src/copy.h
(Stripping trailing CRs from patch.)patching file src/cp.c
(Stripping trailing CRs from patch.)patching file src/mv.c
patch unexpectedly ends in middle of line
Hunk #5 succeeded at 500 with fuzz 1.
Configure
root@prc-04:/tmp/coreutils-8.4#./configure
Make it
root@prc-04:/tmp/coreutils-8.4#make
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. Replace original cp and mv file
root@prc-04:/tmp/coreutils-8.4#cp src/cp /usr/local/bin/cp
root@prc-04:/tmp/coreutils-8.4# cp src/mv /usr/local/bin/mv
BUT 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“.
root@prc-04:/tmp/coreutils-8.4/src# ./cp --version
cp (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjörn Granlund, David MacKenzie, and Jim Meyering.


root@prc-04:/tmp/coreutils-8.4/src# ./mv --version
mv (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Parker, David MacKenzie, and Jim Meyering.
Option to show progress bar while copying, add -g
root@prc-04:/tmp/coreutils-8.4/src# ./cp --help | grep progress

-g, --progress-bar add progress-bar

root@prc-04:/tmp/coreutils-8.4/src# ./mv --help | grep progress

-g, --progress-bar add progress-bar
Copying example.
root@prc-04:/tmp/coreutils-8.4/src# ./cp -g /tmp/test.img /tmp/tes

root@prc-04:/tmp/coreutils-8.4/src# 861.7 MiB / 1.0 GiB[|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--------------------------] 84.1 % Copying at 52.6 MiB/s (about 0h 0m 0s remaining) /tmp/test.img 861.7 MiB / 1.0 GiB[|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||--------------------------] 84.1 % Done

3 comments:

Unknown said...

Link doesn't work any more, the original version has disappeared from the internet.
Is there anywhere else this can be found?

Diantokam 甘忠仁 said...

Thank you for inform me, link moved to dropbox and updated

Unknown said...

ran into a problem during make and solved it with this sed command:
sed -i -e '/gets is a security/d' lib/stdio.in.h