View Full Version : [ubuntu] How to Rename a file with ! Character?

August 3rd, 2009, 04:38 AM
I tried running the command

sudo mv file!.jpg file.jpg

But it keeps giving me this weird error:

bash: !.jpg": event not found

Any idea why this would be happening? I know I can easily rename the file in the GUI, but this is more out of curiosity to prove anything can be done in the terminal.

August 3rd, 2009, 04:39 AM
sudo mv "file!.jpg" "file.jpg"

August 3rd, 2009, 04:45 AM
Actually, it would be like this:

sudo mv file\!.txt file.txt
The backslash is used for characters that could be ambiguous in meaning.

August 3rd, 2009, 05:02 AM
Awesome, thanks! I tried it with the quotes and it didn't work, but the escape character worked perfectly. I know it's kind of a noob question, but thanks for the help!