function for copy files with progress bar (using pv - pipe viewer)

cp_p() { if [ `echo "$2" | grep ".*\/$"` ]; then pv "$1" > "$2""$1"; else pv "$1" > "$2"/"$1"; fi; }
dont have to type new file name (it copy file under same name) and dont have to use '/' in the end of destination folder (but you can if u want, its idiot proof)
Sample Output
cp_p bigfile.iso /tmp

249MB 0:00:25 [9,88MB/s] [=====================================================>] 100%
# note its as fast as cp is, but I have crappy pc so dont look at my speed rate :)
# if u want copy file under other name u have to change code a little

By: chmurli
2010-10-21 10:54:07

What Others Think

Hmm nice one. But I have never experienced any issue with superfluous forward slashes in local file paths. So you could possibly make it a small line.
DaveQB · 534 weeks and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: