I have some weird file in my home directory which name is \e[m
.
I am using Linux. How can I delete it because I tried rm
but it says no such file or directory found
?
5 Answers
If none of the other answers posted here are working, you can always try removing a file based on its inode.
To do that:
- Find the file's inode by doing
ls -i
. Let's suppose the inode number is123456
for\e[m
. - Delete the file based on its inode number: run either
find -inum 123456 -delete
orfind -inum 123456 -exec rm {} \;
.
-
2
-
-
@kampu:
-delete
is not required by the POSIX standard forfind
, so it may not be available in all implementations offind
.– chepnerJun 10, 2013 at 18:28
Honestly, the easiest thing would be to use a file manager that by passes any shell-globing.
Using a shell, I'd try using the shell completion system (assuming you are using a shell with such). Like rm [TAB]
, if your shell gives you a menu and allows you to pick from the menu or cycle through it, you should be able to get completion that is text representation that your shell will recognize.
Possible ways:
rm \\e\[m
or
rm '\e[m'
or
rm "\\e[m"
-
doesn't work... still says no such file or directory– CuriousGuyJun 10, 2013 at 11:19
-
You may have an unprintable character in the file name then. You could try using wild cards such as
rm '\e'*
– Dave NewmanJun 10, 2013 at 11:22 -
-
If \e
is an escape character (ASCII code 27), and you are using the Bash shell, you could try:
rm $'\e[m'
You can use glob expansion. try ls *[[]m
, and if that only returns this file, then you can safely do rm *[[]m
.
If the offending file is not listed with the above ls
command, it certainly contains an escape and the 'm' is not actually a literal m (and/or the [
is not a literal [
)