If you want to copy something using the command-line interface in GNU/Linux, then “cp” is like the universal tool ;-). Although it’s a quite powerful utility, but it has few drawbacks of its own as well.
For instance, unlike with the file managers and their user friendly file copy/move tools, “cp” won’t output a lot of details while copying a file. However, we can use the “-v” attribute to get some basic info, such as the file being copied and the saved file name.
But let’s say you were copying a large file, then other than looking at the LED indicator of your HDD, there’s no way to know how long it’s gonna take or the currently copied percentage, which are otherwise pretty useful.
In that sense, if you’re looking for a file/folder copy utility that’s much rich in features than “cp”, then you should try this tool called “gcp”. It’s a command-line based tool, but unlike with “cp”, while copying a file, “gcp” gives you the estimated time, input/output file names (disabled by default) but most importantly it shows a progress bar and also even calculates the file copying speed too!.
Main features …
*. Lightweight and pretty user friendly.
*. Supports copying files and folders.
*. You can copy single or multiple (lists) files & folders too.
*. Shows a nice progress bar, size of the file being copied, the current file copy speed, plus an “estimated time”. So you’ll know what’s happening at an any given time.
*. The developer says that, unlike with “cp”, “gcp” also has the ability to skip copying a file and move to the next one, if it encounters any file copy errors as well (I did not test it though).
*. If you interrupt the process (press “Ctrl” + “c” to cancel), then it’ll save the partially copied content rather than deleting it.
*. Shows the file system type (whether it’s “ext4/3 …” so on), the source file and the destination file names. However, these details are hidden by default to keep things simple. But you can use the “-v” attribute to enable it (as shown below).
*. You can save a list of files that needs to be copied and load it later.
That’s pretty much it.
If interested, you can install “gcp” in Ubuntu 12.04 Precise Pangolin and 11.10 Oneiric Ocelot (don’t have pre-build packages for other versions right now) by simply typing the below commands in your Terminal window.
sudo apt-get install gcp
Installing in other older Ubuntu versions …
“Both 11.10 and 12.04 user can skip this and scroll down a bit, if you want one or two simple examples”
Launchpad doesn’t currently have pre-build packages of “gcp” for older versions of Ubuntu such as 11.04 Natty Narwhal, 10.10 and 10.04. But luckily, you can easily install “gcp” in those ones as well.
Now I did not test this with those versions, instead, I manually installed it in Ubuntu 11.10. So the below method should work for you if you use those older versions of Ubuntu nonetheless.
1. First we have to manually install a package called “python-progressbar”, which as you can guess from the name, is what that generates those pretty file copy progress-bars :D. For that, open your Terminal window and enter the below command.
sudo apt-get install python-progressbar
2. Now, go to this Gcp home page and download the latest package.
2. Once the download completes, double click on the file and extract the content, to your Home folder for instance.
3. Then, open your Terminal and change directory (“cd”) to that folder.
For my “gcp” version, I’ll use the below command for that. But depending on your downloaded file’s version, please change the text marked in “Red” accordingly.
4. Then simply issue the below command which should install it.
sudo python setup.py install
If it’s successfully installed, then you should see an output similar to the below one (it only contains the last few lines) and it won’t take more than few seconds either.
That’s it!. Now you can start using it.
Few simple examples …
The basic usage of “gcp” is as follows.
gcp source-file destination
Let’s say that I have a file called “2.iso” in my “Desktop” and I wanted to copy it to my “Home” folder. Then I’d use the below command for that.
gcp Desktop/2.iso /home/gayan
It should give me a pretty output 😉 while copying as shown in the above screenshots.
If you have more than a single file, then use it in the following format.
gcp first-file second-file destination
For instance, let’s say that I have two files (called “video.mkv” and “disk-image.iso”) in my Desktop that I want to copy to my Home folder. Then I’d use the below command for that.
gcp Desktop/video.mkv Desktop/disk-image.iso /home/gayan
Copying folders …
Copying the content of a folder is pretty easy. Just like with “cp”, we can use the “-r” attribute in the below format.
gcp -r source-folder destination
Again, if you have multiple folders then type their proper path, one after the other in the below format.
gcp -r source-folder1 source-folder2 destination
For an example, let’s say that I have a folder called “temp” in my Desktop that I want to copy my Home folder with “gcp”. Then I’d use the below command for that.
gcp -r Desktop/temp /home/gayan/
You can learn few of its other commands by reading the manual page as well. For that, please use the below command.
So, as an ending note, if you’re a bit frustrated by the somewhat “limited” output details in “cp” and looking for a much user friendly, command-line based file copier that gives you a progress bar and few other useful outputs while running, then “gcp” is a must have!. A big thank goes to “Jérôme Poisson” for creating it.
7 thoughts on “gcp: Command-line Based File Copy Tool for Ubuntu Linux”
So much bloat. What happened with the Unix philosophy?
Well, I don’t know mate, but I kinda like this ;-).
I use the following alias instead:
alias cpv=”rsync -pogr –progress”
Thank you Jörg.
alias gcp=’rsync -P’
is close enough for most people.
Has any one had sucess installing this on CentOS? I get a progress bar error.