Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just noticed that I have a file called ~ in my ~-directory.

$ ls -la ~
-rw-r-----  1 x1 x1  733962240 Mar  1 17:55 ~

Any idea how I can mv or rm it?

share|improve this question
Try to delete it by i-node. –  gronostaj Jun 19 '13 at 5:25

3 Answers 3

up vote 40 down vote accepted

The pretty much ultimate solution when it comes to files that can't be deleted by normal means:

ls -il 

The first column will show the inode number of the files.

find . -inum [inode-number] -exec rm -i {} \;

This will delete the file with the specified inode-number after verification.

share|improve this answer
This worked. Perhaps the the solution by rici is good too, but I didn't try. Thanks a lot! –  scrrr Jun 19 '13 at 7:46
Yes, rici's answer is good too. And I think it's better because it's simpler. –  Andrey Regentov Jun 20 '13 at 4:51
nice, +1. I changed your answer to use -delete instead of -exec, then realized that you were using rm -i which is a good idea so I rolled back. Sorry. –  terdon Jun 26 '13 at 23:21
Don't worry. Always glad when somebody deems my answers worthy of their time :) –  Squeezy Jun 29 '13 at 22:19

You should be able to refer to that file as ~/~ (without quotes) because tilde-expansion only applies the the tilde (~) at the very beginning of the word.

share|improve this answer
also, going to the folder and rm ./~, for the same reason you said –  Carlos Campderrós Jun 19 '13 at 7:10

Quote it (rm '~') or escape it (rm \~).

It's always either of those (also for e.g. $), or add -- to prevent the file name from being interpreted as argument: rm -- -i removes the file named -i; also useful for rm -- * in case there are files named like this present.

share|improve this answer
Hm, no that doesn't seem to work.. I tried the single quotes, the escaping and backticks.. he doesn't pick up the file. Says either it doesn't exist or interprets ~ as the home-directory.. –  scrrr Jun 19 '13 at 5:08
@scrrr What's your shell? –  Daniel Beck Jun 19 '13 at 7:49
bash. But problem solved the inode way. –  scrrr Jun 19 '13 at 9:06
@scrrr Glad your problem is solved, but now I want to know why bash escapes don't work the same way on your system as it does on mine. –  Isaac Rabinovitch Jun 25 '13 at 21:28
Careful. -- only stops the following arguments being interpreted as parameters - it doesn't prevent the shell from performing its expansion (e.g. *), which is what's happening here. (I know you suggested it as an alternative for other situations, but a warning would be good.) –  Bob Jan 30 '14 at 0:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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