Skip to content

[Linux] Show a progress bar when copying file

Last Updated on 2021-06-18 by Clay

If we need to copy some big files to another path, we always afraid our copy process dead. It's very terrible if we forgot to use "screen" or "nohup" instructions (screen is an instruction that can execute a program in the background. Maybe you can refer here: [Linux] Using instruction “screen” to put process in background)

Especially when there is a lot of data.

In order to solve this problem, I found some information, hoping to display a progress bar when we copying the file.


How to use "gcp"

I have tried several well-known instructions such as "rsync -aP", "progress" with "watch" ... and so on. But I think the easiest and clearest display of large number of file progress bar must be the "gcp" instruction.

If you never install "gcp" instruction in your computer, you need to use the following instruction to install:

sudo apt install gcp

After the installation is complete, we can use "gcp" to replace the "cp" instruction. For example, I want to copy the the following folder:

gcp -r html/ html_temp/

Output:

In this way, there is no need to worry about whether the copied program dies midway when running large files.


Postscript

In Linux, copying files does not show a progress bar, not because the person who developed the function has forgotten it, or this function is not necessary.

Because it is necessary to copy the file and monitor the data copy progress at any time, which will make the file copy efficient Decrease.

In addition, there are many ways to display the progress bar. Moreover, you can customize it according to your favorite mode.

This is where Linux systems are interesting.


References

Tags:

Leave a ReplyCancel reply

Exit mobile version