20
2
I'm using terminal on a Ubuntu machine and there is a file that I would like to delete. The file's name is \
(just a backslash).
Now usually I would just do
rm filename
However if I do rm \
then it thinks I'm trying to write a multi-line command.
How can I delete this file? I know that I could just use the GUI file system, but that's not very efficient.
So, how can I delete (in terminal) a file called \
?
This requires the escape character, see here
– MDMoore313 – 2013-07-29T18:28:06.387possible duplicate of Unix: Files starting with a dash, -
– Ulrich Schwarz – 2013-07-29T18:28:21.4971Why do you have a file named that? (It doesn't even let me put it in a
code
block here in this comment!) – AJMansfield – 2013-07-29T19:59:20.7477More fun is trying to delete a file called <BEL>, aka Ctrl-G if I recall correctly. Everytime you do a ls the keyboard beeps at you until you (a) discovered the invisible file; and (b) determined how to delete a file with only one unprintable character in its name. – Pieter Geerkens – 2013-07-30T00:48:23.610
1More importantly, how do you delete a file named "/" ? – Curt – 2013-07-30T01:44:53.650
1@Curt
fsck
. Seriously. If a file named/
exists, your filesystem is corrupt. – zwol – 2013-07-30T02:42:23.3232I always liked the file named
*
myself... – RBerteig – 2013-07-31T05:53:22.1331@Pieter Geerkens, +10, I shall try this! How do you create a file with the name of unprintable character? – Vorac – 2013-07-31T14:40:20.873
@Vorac: Now that you know it is possible - figure it out yourself. It's the knowing it's possible that is the real challenge; the rest is just good clean fun. – Pieter Geerkens – 2013-08-23T03:53:19.760