Bypassing Aliases in Linux

Now I consider myself to be a real novice in Linux. I know the standard stuff like ls, mkdir, etc, but anything else I have to Google. For instance, I’ve just had to copy a load of files from one user account to another on the server and when I did this first it didn’t quite work. Ok, so I just do it again right? Wrong. Now there are a load of files in the destination folder that already exist so I’m getting a load of “overwrite?” prompts which need me to manually type “yes” each time – not fun when you have 1000s of files to process.

Anyway, time to Google “linux cp overwrite” and lo and behold the issue seems to be that most modern systems add an alias of “cp -i”  to the “cp” command when you run it as root – this basically means “interactive” or “prompt user to overwrite”. To view a list of aliases in Linus, you just have to type “alias”, I did this and yep, I had an alias on my cp function. Anyway, to overrule that alias you just need to prefix the command with a slash, so “cp /folder/ /newfolder/” becomes “\cp /folder/ /newfolder/” – easy!

Another thing learned.

Leave a Reply

Your email address will not be published. Required fields are marked *