Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm having problems when copy large files using nautilus (it gets stuck) so I need to copy using cp. I would like to know if there is any parameter that shows the % copied and also the transfer speed.

share|improve this question
9  
You could use rsync instead of cp. It has a --progress option. –  frostschutz Feb 17 '13 at 14:15
    
Midnight Commander also works well, and has a pretty text-based UI with progress bars, but might not be installed. Try mc on the command prompt. Also, obviously, it's not cp. –  Michael Kjörling Feb 17 '13 at 14:24
1  
Using rsync with --progress just made me figure out what is happening. It gets stuck when it reaches the 100%, and then last a couple of minutes in end up. I think is the same that is happening with nautilus. Anyway that is another question already, so the best answer for this question is the rsync --progress, it shows size, %, speed and elapsed time. –  yzT Feb 17 '13 at 15:16
    
I have a question about the rsync --progress. Assume that I have the directory A with files a and b and the empty directory B, when I copy A to B it shows the progress of each file, i.e. the progress of a and the progress of b. Is there any way to show the overall progress? –  yzT Feb 17 '13 at 15:33
add comment

4 Answers

If you allow other tools than cp it's surely possible. For a single file you can use pv. It's a small tool providing nice statistics.

pv inputfile > outputfile

If you have multiple files or directories you can use tar:

tar cf - sourceDirectory | pv | (cd destinationDirectory; tar xf -)

You can wrap it in a shell function. It's less to type and you get semantics close to the ones of cp. Here's a very simple (and not error-proof!) function:

cpstat () {
  tar cf - "$1" | pv | (cd "$2";tar xf -)
}

You call it like this

cpstat sourceDirectory destinationDirectory

You can enhance it further, so that pv provides an estimation of the remaining time.

Another solution (as frostschutz mentioned in a comment) is to use rsync with the --progress option:

rsync --progress -a sourceDirectory destinationDirectory
share|improve this answer
    
cpstat is going in the pastebin =) –  mtm Feb 17 '13 at 14:57
add comment
up vote 11 down vote accepted

The nightly version of rsync has a new parameter called --info=progress2 which shows the overall %.

share|improve this answer
add comment

Not in a standard version of cp.

You could background the cp and list the size while waiting for cp to finish.

I use this perl to monitor growth of a single file but it runs externally to the cp (or whatever else I'm doing)

share|improve this answer
add comment

rsync works the best for showing the progress during the copying progress.

ex:

rsync -avh --progress sourceDirectory destinationDirectory
share|improve this answer
    
Do you realize this question was answered almost a year ago? –  yzT Jan 2 at 9:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.