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?


If none of the other answers posted here are working, you can always try removing a file based on its inode.

To do that:

  1. Find the file's inode by doing ls -i. Let's suppose the inode number is 123456 for \e[m.
  2. Delete the file based on its inode number: run either find -inum 123456 -delete or find -inum 123456 -exec rm {} \;.
| improve this answer | |
  • 2
    Upvoted, but note -delete is probably better than -exec rm {} \;. – kampu Jun 10 '13 at 12:31
  • You're right. Thanks. I've updated the post to reflect your suggestion. – cmt Jun 10 '13 at 12:44
  • @kampu: -delete is not required by the POSIX standard for find, so it may not be available in all implementations of find. – chepner Jun 10 '13 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.

| improve this answer | |

Possible ways:

rm \\e\[m


rm '\e[m'


rm "\\e[m"
| improve this answer | |
  • doesn't work... still says no such file or directory – CuriousGuy Jun 10 '13 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 Newman Jun 10 '13 at 11:22
  • rm "$HOME"'/\e[m'? – cmt Jun 10 '13 at 11:22
  • Maybe the actual name of the file is not \e[m? – Adam Siemion Jun 10 '13 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'
| improve this answer | |

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 [)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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