Bash: Using Aliases to use cp with a progress bar

In bash, (default linux/mac command shell), you can add aliases for common commands which you type regularly. You can either specify them inline, which will mean that they are destroyed when your session ends, or add them to your .bash_profile. Let's give it a go.

Let's say that we want the command 'pc' to alias with 'rsync --progress' for more verbose copying. We'll need to change the following file:

nano ~/.bash_profile

adding the following content

alias pc='rsync --progress'

and then, load the new config by either restarting your terminal program, or loading the file manually as follows.

source ~/.bash_profile

And voilà, now when you type a command such as the following, you should see a more verbose output of copy progress. (the -r flag is for recursive, as it is passed as normal to rsync so you can copy directories)

pc -r folder1 folder2
Published 2016-09-03