Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 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 at 0:44

2 Answers 2

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