In my /home/user/.bashrc file, I have those aliases to prevent mistakes:

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

If I'm really sure of what I'm doing, I can overwrite rm and mv aliases using rm -f or mv -f, it will not ask me if I really want to overwrite files.

The problem, is that it doesn't work for the cp command, using cp -f will still ask me a question.

Is this normal? What should I do in order to have cp -i alias by default and be able to use cp -f command too?

I'm using Debian Wheezy 64bit.

2 Answers 2


By giving cp -f, the option simply adds up with the existing option.

That is, if you have an alias cp='cp -i', the word cp gets replaced in the command cp -f, so you get cp -i -f file1 file2.

To override the alias:

\cp -f file1 file2

The backslash before the command will disable the alias. You can use command cp instead of \cp for readability.

  • I made a mistake in my post, when I talked about cp -r, I meant cp -f, it's corrected. Your solution with a backslash is working, thanks! But I still don't understand why the backslash is not needed for mv or rm command, the alias is directly disabled with mv -f and rm -f!
    – baptx
    Dec 3, 2012 at 12:52

While -f means force on all of them, for cp, it means force by trying to remove the destination first if the destination can't be updated.

For mv and rm, -f just overrides -i. But for cp, it changes the behavior of the utility, -f is not the opposite of -i in that case, cp -i -f makes sense and means, if the target exists, ask the user and if it can't be overridden, remove it first.

Even for mv and rm, adding -f is not the same as removing -i when it comes to warning and error messages sent to the user. For instance rm non-existent-file would report an error while rm -i -f non-existent-file would not.

As already mentioned, to remove the effect of -i, instead of adding -f, you should disable the alias using any of the solutions provided.

  • "For mv and cp, -f just overrides -i." You mean mv and rm I think. Thanks for explaining, it is very clear to me now!
    – baptx
    Dec 3, 2012 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.