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.

Is this possible?

share|improve this question
    
Maybe I'm interpreting 2577 wrong, but it sounds like the OP is saying "cp has the -g switch to show progress; what's the equivalent for mv?", and the answers just focus on cp for some unknown reason (maybe the trailing ? in the question was confusing, but I think that was unintentional). It seems like the opposite of this question –  Michael Mrozek Oct 28 '10 at 20:28
1  
@Michael @Stefan this looks like "transfer speed" while the other is "progress". Progress is how much has been transferred of the whole, and speed is how fast. Different questions. –  xenoterracide Oct 28 '10 at 22:35
    
yes. i lay down my sword. :) i was hasty –  Stefan Oct 29 '10 at 8:06
    
@xeno @michael, are we removing our comments here? :) –  Stefan Oct 29 '10 at 8:07
    
@Stefan, no real reason to... the link to the other post was at least interesting in the case of this. –  xenoterracide Oct 29 '10 at 8:27

3 Answers 3

The standard coreutils cp command doesn't support this. There's a Gentoo patch floating around that adds it for different versions, although it's not included in Gentoo anymore for some reason; the version for coreutils 6.10 is in their bugzilla, and I'm sure there are lots of others around.

If you don't want to patch cp, you need to use some other command. For example, rsync has a --progress flag, so you can do:

rsync --progress source destination

If instead of copying you cat the data and then redirect stdout to the destination (i.e. cat source > destination), then you can use a program that measures pipe throughput and insert it in the middle (cat source | SOME-PROGRAM > destination); there are a couple mentioned in this related question. The one I recommended there was pv (Pipe Viewer):

Screenshot of pv from the pv homepage

If you give it the --rate flag it will show the transfer rate

share|improve this answer
    
Very interesting, although not worth the effort. I merely would like cp <source> <dest> to provide a rate similar to how it would report transfer rate using the GUI. Not worth the effort to type that much text just to see the transfer speed. Thanks though. –  Chris Oct 28 '10 at 14:27
7  
@Chris Well, you can always add a function for it. function cprate() {cat "$1" | pv --rate > "$2"} –  Michael Mrozek Oct 28 '10 at 14:45
    
pv seems good, but I tried it for the same reason as the poster (progress/rate when copying to nfs), where the file gets crated in tmp and transferred afterwards. So, instead of nfs I have to use smb to see progess and rates. –  user16487 Mar 11 '12 at 15:45
    
Using "cat" is a very dangerous method, I have experienced that cat on some AIX Systems will cut out what they interpret as garbage. Depending on the character set you chose by default. I would agree totally with rsync! –  Oliver Stutz Aug 13 at 13:31

I find that using pv in this manner works well for that purpose

pv -p file1 > file2
share|improve this answer
1  
pv? <filler text> –  Chris Oct 29 '10 at 17:34
2  
pv is Pipe Viewer, and is pretty awesome. @Patrick, please expand your post with an explanation. –  Stefan Lasiewski Oct 29 '10 at 18:55
2  
This is the same command I mentioned in my answer, although I didn't realize it takes a filename argument (I did cat file | pv) –  Michael Mrozek Oct 30 '10 at 1:31
    
Good explanation: catonmat.net/blog/unix-utilities-pipe-viewer –  Kay Nov 25 '11 at 1:40

Hi Another way to show the transfer speed is to use scp on localhost like this:
scp -rv src_folder user@localhost:/dest_folder

share|improve this answer

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.