size=`wc -c a` ; cp a b & sleep 1 ; ETA 'wc -c b' $size
Every 10 seconds it runs the given command, then gives an ETA to the number you want. It's not a progress bar, but it is a projected time of completion and can easily be extended if you want.
ETA is like pv but for those occasions when you don't have access to the data stream in a pipe. It can be used anytime you can compute a number that indicates how far along you are. Just give it the command to run for itself, or run the command and feed the values to ETA on stdin and it will give you regular estimates of when it will hit the given target.
It also lets your cp run at full speed, unlike when you copy through pv, and is more generic than just checking on the progress of specifically a copy command. It lets you predict the completion time of anything measurable.
I love pv. It's great because it's pretty much a drop-in for "cat" that gives you fancy progress bars. But for copy I tend to use "rsync -aP". It has progress but not a bar and just feels more like a replacement for cp to me.
I use rsync -avzP exclusively now over cp ever since I tried copying ~7000 files from a USB drive and found cp choked less than 10% through. rsync is wonderful.
That doesn't give you a progress bar because it doesn't know how big the data stream will be. You need to pass in some options to pv to give it that information.
On some BSDs (including Mac OS X) there is a signal, SIGINFO, to which cp will respond by printing out a status report. You can send this signal by typing ^T.
[+] [-] RiderOfGiraffes|16 years ago|reply
http://news.ycombinator.com/item?id=1149364
ETA is like pv but for those occasions when you don't have access to the data stream in a pipe. It can be used anytime you can compute a number that indicates how far along you are. Just give it the command to run for itself, or run the command and feed the values to ETA on stdin and it will give you regular estimates of when it will hit the given target.
It also lets your cp run at full speed, unlike when you copy through pv, and is more generic than just checking on the progress of specifically a copy command. It lets you predict the completion time of anything measurable.
[+] [-] gommm|16 years ago|reply
[+] [-] panic|16 years ago|reply
[+] [-] __david__|16 years ago|reply
[+] [-] philjackson|16 years ago|reply
*Hmmm, I can't back up my own predictions:
[+] [-] w1ntermute|16 years ago|reply
[+] [-] petercooper|16 years ago|reply
[+] [-] RiderOfGiraffes|16 years ago|reply
In the BUGS section of the man page you can find these items (amongst others):
Hmm. That's useful to note. I can understand that, although it could be surprising in practice for the unwary. Understandable. That's definitely worth knowing. Damn.[+] [-] jrockway|16 years ago|reply
But of course, nothing is stopping you from commenting this check out.
[+] [-] yellowbkpk|16 years ago|reply
[+] [-] erso|16 years ago|reply
[+] [-] lamby|16 years ago|reply
[+] [-] metabrew|16 years ago|reply
[+] [-] jimbokun|16 years ago|reply
[+] [-] shykes|16 years ago|reply
cp $SOURCE /dev/stdout | pv | cp /dev/stdin $DEST
Edit: "pv <a >b" is simpler, but isn't the game to fit "cp" somewhere? :)
[+] [-] RiderOfGiraffes|16 years ago|reply
[+] [-] freshprince|16 years ago|reply
[+] [-] khill|16 years ago|reply
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] gwern|16 years ago|reply
[+] [-] tesseract|16 years ago|reply
[+] [-] icco|16 years ago|reply
[+] [-] tzury|16 years ago|reply
[+] [-] volomike|16 years ago|reply
[+] [-] sabat|16 years ago|reply