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 mistakenly create ~ in ~/source

sx@ubuntu:~/source$ pwd
/home/sx/source
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 stackoverflow.com Dec 5 '12 at 20:04

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

    
In your case you can use rm -r "./~" but I've posted more general solution. –  power Dec 5 '12 at 18:43

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

Your Answer

 
discard

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