Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to rm a directory and its contents, however for whatever reason rm is ignoring escape characters.

In this example, I'm trying to remove the folder Team Fortress 2 from ~/.local/share/Steam/SteamApps/common:

[nysepho@arctic common]$ rm -r Team\ Fortress\ 2/
/usr/bin/rm: cannot remove ‘Team’: No such file or directory
/usr/bin/rm: cannot remove ‘Fortress’: No such file or directory
/usr/bin/rm: cannot remove ‘2/’: No such file or directory

I've also tried wrapping the directory name in quotes:

[nysepho@arctic common]$ rm -r 'Team\ Fortress\ 2/'
/usr/bin/rm: cannot remove ‘Team\\’: No such file or directory
/usr/bin/rm: cannot remove ‘Fortress\\’: No such file or directory
/usr/bin/rm: cannot remove ‘2/’: No such file or directory

Here's the output from rm --version:

rm (GNU coreutils) 8.21
...

Why would this be happening?

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

My first guess would be that rm is a poorly defined function or script, e.g., something like

rm()
{
    /usr/bin/rm -i $1
}

To find out, execute this command:

type rm

If I'm wrong, it will say:

rm is /usr/bin/rm

If I'm right, it will tell you exactly how rm has been redefined.

share|improve this answer
    
Thanks - I had a function for rm that I had since removed, but I was running the command here in a tmux session that was still using my old .bashrc. rm is now working again. –  Nysepho Dec 14 '13 at 15:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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