Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 '14 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
3  
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

I know this is rather old, but...

If you do not actually want to display the rate, but only want to watch if something is happening on copying of a large file, you can also just use the watch command (also works with mv):

cp /path/to/myfile /path/to/target/myfile

Then, in another shell, or pushing the copy-command to the background (e.g. with Ctrl + Z followed by bg), you can check the result with:

watch "ls -sh1 /path/to/target"

This will continuously update the output of the ls command update (by default every 2.0s), displaying something like:

Every 2.0s: ls -sh1 /path/to/target                                      
Tue Jan 12 15:02:45 2016

total 1.1G
4.0K data
130M tmp1.txt
137M tmp2.txt
151M tmp3.txt
168M tmp4.txt
162M myFile
share|improve this answer

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

maybe you should install and try gcp

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.