The GNU/Linux operating system uses GNU cp and GNU mv tools to copy and move files and folders. One of the missing features of these two administrations is that they do not show a progress indicator. When you copy a large file or folder, you don’t really know how long the copying process will take or what percentage of the data will be copied. You cannot see which file is being copied or how many have already been copied. All you see is a blinking cursor and an LED indicator on your hard disk. With Advanced Copy, a patch for Gnu Coreutils, on Linux, we can now add a progress bar to the cp and mv commands and display a progress bar when copying and/or moving large files and folders.
The advanced copy is an adaptation for the GNU cp and GNU mv programs. It adds a progress bar and provides information about what happens when you copy or move files and folders. Next to the progress bar, the baud rate, the estimated remaining time and the name of the file to be copied are displayed. At the end you will see a short description of the number of copied files and the time it takes to copy them.
Install the Extended Copy patch to add a progress meter to the cp and mv commands on Linux.
The cp and mv commands are part of the GNU Coreutils. So you need to download the latest version of GNU Coreutils here.
wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.32.tar.xz
Unpack the downloaded archive with the command
tar xvJf coreutils-8.32.tar.xz
This command extracts the coreutils archive from the directory named coreutils-8.32 in the current directory. Do it. Do it:
$ cd coreutils-8.32/
Download the Extended Copy patch with the following command:
$ wget https://raw.githubusercontent.com/jarun/advcpmv/master/advcpmv-0.8-8.32.patch
Finally, apply the patch by executing the following commands in sequence:
patch -p1 -i advcpmv-0.8-8.32.patch
$./configure
$ make
Two new patches have now been created in the coreutils-8.32/src directory, cp and mv. Just copy them into your $PATH as shown below:
sudo cp src/cp /usr/local/bin/cp
$ sudo cp src/mv /usr/local/bin/mv
Here we go. The cp and mv commands now have the functionality of a progress bar.
When you need a progress bar to copy or move files and folders, just add the -g flag, as shown below
$ cp -g archlinux.iso mydownload/
Or use the progress bar indicator :
$ cp –progress-bar archlinux.iso mydownload/
Taking samples:
Copy with 25.7 Mb/s (about 0h 0m 1s remaining time)
archlinux.iso 568.1 Mb / 646.0 Mb
[=========================================================================> ] 87.9%.
Add a progress bar for cp and mv teams on Linux
At the end of the copying process, you can see how many files were copied, how long it took to copy the file(s), and the transfer speed per second. That’s good, isn’t it?
1 file (646.0 MB) was copied in 11.8 seconds (54.7 MB/s).
To recursively copy the directory and its subdirectories, simply add the -R:
$ cp -gR directory1/ directory2/
To move files with the mv command, run it as well:
$ mv -g archlinux.iso mydownload/
Or use the progress bar indicator :
$ mv –progress-bar archlinux.iso mydownload/
Use the mv command to move folders:
$ mv -g directory1/ directory2/
You can also create nicknames to save multiple keystrokes. To do this, edit the ~/.bashrc :
$ nano ~/.bashrc
Add the following lines at the end:
alias cp=’/usr/local/bin/cp -gR’
alias mv=’/usr/local/bin/mv -g
Press Ctrl+o and Ctl+x to save and close the file.
Now execute the following command to make the changes effective:
Source ~/.bashrc
Now you can simply use the cp or mv commands without the -g (or –progress-bar) flag.
Please note that the original programs will not be overwritten. You can always access it via /usr/bin/cp or /usr/bin/mv.
Adding a progress bar to the cp and mv commands is a good idea if you often copy or move a lot of large files and folders. Now you can see exactly what happens when you copy and move files instead of looking at the screen.
Means :
Sounds like reading:
Related Tags:
pv copy directory,rsync move,rsync vs cp,rsync progress,progress viewer,how to check the status of mv command,progress command linux,advcpmv github,rsync move local,linux pv directory,ubuntu pv,rsync recursive copy,rsync copy with progress,ubuntu cp get progress,pv show speed,arch copy with progress,bash copy status,cp command verbose output,shell cp verbose,copy with progress bar linux,cp progress bar,how to check copy progress in linux,linux mv progress bar,linux progress command,cp percentage linux