Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

As great as Linux/Bash is, sometimes I wish some of the built-in commands did a little bit more than the bare minimum. Of these the 'cp' command is something that I always thought should have had a way to show progress when copying files. There are many questions about this very thing on StackExchange like this one and this one. My preferred solution is to use 'rsync' but I'm also a big fan of simplifying things and can never remember all the various command line options required. So this post shows my little trick to enabling file copy speed and percentage display when copying files.

I simply add the following line to my ~/.profile file:
 ~/.profile
alias cp2='rsync -aPWh'


Then I can do something like this...
 Terminal
cp2 tmpfile tmpfile2


...and the results look like this:
rsync_cp.png




Lets see what those command line options all mean.
 Command Line Options
a - Archive Mode
P - Shows the progress and keeps partially copied files
W - Does not use the rsync protocol, simply copies whole files
h - Shows output in human readable format


As a bonus, since 'rsync' is used as the underlying command to copy files, you can also copy files from remote servers, much like when using 'scp'.

Here's another useful alias I've created: Add a filter/search option to the OS X Terminal history command

-i

Please leave your comments or feedback below!
comments powered by Disqus
Other posts you may like...
Hi! You can search my blog here ⤵
Or browse the recent top tags...

Recent Blog Posts

Tiny Arcade revision 6 kit assembly and decal application

Jersey JAX-RS filters and interceptors execution order for a simple GET request

How to stop macOS adding shadows to window screenshots

How to run Atari Lynx games on the SNES Classic Mini

Maven dependency scopes with relation to WAR file packaging and the WEB-INF/lib directory

Hacking the Sonoff B1 WiFi LED bulb to run custom firmware

What does an idle WebLogic server run on the hour to cause a CPU spike

How to open the Sonoff B1 wifi LED bulb to access its internal circuitry

Australian release SNES mini classic unboxing and a quick play through

Troubleshooting high CPU usage for JVM threads

Recent Galleries

Atari Lynx repair - Part 5 - McWill LED screen mod installation

Atari Lynx repair - Part 4 - screen cover replacement

Atari Lynx repair - Part 2 - re-capping the motherboard

Atari Lynx repair - Part 3 - broken speaker replacement

Atari Lynx repair - Part 1 - introduction and case disassembly

Building a custom Atari Lynx game box storage shelf unit in a day

Protecting old Atari Lynx game boxes with snug fit plastic sleeves

Monument Valley 2 is released and does not disappoint

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

Blogs and Friends

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity