Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Jun 10 '13 at 14:19

This question came from our site for professional and enthusiast programmers.

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 {} \;.
share|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.

share|improve this answer

Possible ways:

rm \\e\[m

or

rm '\e[m'

or

rm "\\e[m"
share|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'
share|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 [)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .