Results 1 to 8 of 8
How would I remove a file that has a name with non-letter characters in it?
Example: hello!.txt
When I try to use the "rm" command I get shell errors because ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-09-2002 #1Linux User
- Join Date
- Nov 2002
- Posts
- 420
removing files
How would I remove a file that has a name with non-letter characters in it?
Example: hello!.txt
When I try to use the "rm" command I get shell errors because of the exclamation point.
- 12-09-2002 #2Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Escape the exclamation mark either by typing hello\!.txt (that's a backslash) or 'hello!.txt' (single quotes, double won't work).
- 12-09-2002 #3What? I've always used double quotes without problems.
Originally Posted by Dolda2000
Figures...
- 12-09-2002 #4Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
It usually works, but ! is a very special character. I don't know exactly what it does, though, but it seems to be more internal than ordinary substitutions.
- 12-11-2002 #5Just Joined!
- Join Date
- Oct 2002
- Posts
- 45
rm filename with spaces
Say you created a file with the name
"dont worry, just looking around!?dont" decided that this wasn't such a good idea, and would like to remove it.
When I use the "rm" command, the shell tells me that it cannot find this file. I thought that this was because of the exclamation point, but even when I escape the exclamation point with a \ I still have problems. I also tried specifying the path like this: rm /home/users/user/"filename\!"
- 12-11-2002 #6Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
Works perfectly for me. Just enclose the file name in single quotes, or tab complete it.
- 12-11-2002 #7Linux User
- Join Date
- Jul 2002
- Location
- Daytona Beach, FL
- Posts
- 487
about time someone said tab-complete
majorwoo
Quiet brain, or I\'ll stab you with a Q-tip.
- 12-14-2002 #8Let us all bow down before the altar of Tabcompletius and praise the Gods of Shell.
Originally Posted by majorwoo


Reply With Quote
