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

This question already has an answer here:

I mistakenly create ~ in ~/source

sx@ubuntu:~/source$ pwd
sx@ubuntu:~/source$ ll
total 440
drwxr-xr-x  3 sx sx   4096 2012-12-06 02:25 ~
drwxr-xr-x  4 sx sx   4096 2012-12-06 02:25 ./
drwxr-xr-x 47 sx sx   4096 2012-12-06 02:26 ../

I don't dare to delete it using command rm ~, because it may lead to deleting all my file in home dir.

share|improve this question

migrated from Dec 5 '12 at 20:04

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

marked as duplicate by fixer1234, Tetsujin, Kevin Panko, Excellll, DavidPostill Apr 17 '15 at 6:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

In your case you can use rm -r "./~" but I've posted more general solution. – power Dec 5 '12 at 18:43
This has been answered before:… – fswings Apr 16 '15 at 0:44

There is general solution to delete files with uncommon names: first you need to know file's inode number, then you can delete it with find command

$ mkdir "~"
$ ls -i
>28972221 ~
$ find -inum 28972221 -delete
share|improve this answer

As always, specify the path.

rmdir ./~
share|improve this answer