Most of you have noticed that the
cp command won't display the copy progress while copying files/folders. When I am copying a large file with
cp command, I really have no idea how long it is going to take, or what is the currently copied percentage. Other than looking at the blinking cursor icon in the Terminal and the hard drive indicator while copying large files, I have no idea whether copying progress is really going on or not. Not anymore! Here is where
gcp utility comes in help. The gcp (Goffi's cp) is an advanced file copier tool, heavily inspired from the traditional
cp command utility, but with some additional features. It is completely free and open source software, released under GNU General Public License.
cp command, the gcp utility offers the following high-level functionalities:
- Displays the copy progress indicator, with estimated time, current file speed etc.
- gcp continue copying even when there is an issue. It will just skip the problematic file from copying and copy the next files.
- It can copy both single or multiple files or folders.
- gcp logs all its action. So, we can easily find which files have been successfully copied.
- If you accidentally cancels a copy process, it will keep the record of it. Instead of deleting the contents, it will keep the partially copied content. You can then run the copy process again, and it will copy the rest of the files where you left it.
- If you launch a copy when an other is already running, the files are added to the first queue, this avoid your hard drive to move its read/write head all the time.
- You can save a list of files you copied and copy them again later from that list. It will be very useful when you want to copy the same files to multiple targets.
In this brief guide, I will show you how to install and gcp in Linux and Unix-like operating systems.
Install gcp on Linux
gcp is available in the default repositories of Debian, and Ubuntu. You can install by simply running the following command from the Terminal:
$ sudo apt-get install gcp
For Arch Linux, and its derivatives, It is available in AUR. So, you can install it using any AUR helper, for example Yay.
$ yay -S python-gcp-git
Then, install the python-progressbar package, which is used to display the progress bar while copying files.
$ yay -S python-progressbar
$ pip3 install gcp
And, finally, install python-progressbar.
$ sudo apt-get install python-progressbar
How to use gcp, the advanced file copier, in Linux
gcp usage is pretty much same as cp command's.
The typical usage of gcp is:
gcp [OPTIONS] FILE DEST gcp [OPTIONS] FILE1 [FILE2...] DEST-DIR
Let me show you some practical examples. The following command will copy the contents of Dir1 to a directory called Dir2.
$ gcp Dir1/video.mp4 Dir2/
Copying 876.53 MiB 100% |############################| 30.08 MB/s Time: 0:00:30
As you see in the above output, gcp command shows the copy progress indicator, with estimated time, current file speed etc. It will makes us easy to find what is really going on.
To copy multiple files, just specify them one after the another and the target directory like below.
$ gcp file1 file2 Dir
To copy a folder to another folder, use
-r flag like below.
$ gcp -r Dir1/ Dir2/
If you don,t want to see the progress bar, you can disable it using
$ gcp --no-progress source destination
If the target folder already has the same file, you will get the following warning message:
File [/home/sk/Dir2/video.mp4] already exists, skipping it ! /!\ THE FOLLOWING FILES WERE *NOT* SUCCESSFULY COPIED: - /home/sk/Dir1/video.mp4 -- Please check journal: /home/sk/.gcp/journal
You can verify the journal file whether the previous file process is successfully complete or not.
$ cat /home/sk/.gcp/journal
If the output is OK, the copy process is success. If the output is PARTIAL, It means that the file was copied, but something went wrong (e.g. changing the permissions of the file). FAILED means - the file was not copied.
For more details about gcp utility, run the following command:
$ gcp --help
Or, refer the man pages.
$ man gcp
The progress bar for
mv commands can be easily added using a patch named "Advanced Copy". For details, check the following link.