Need to delete a directory with name '~' created accidentally

Just quote the directory. I use rmdir just to ensure you don't accidently delete your home directory.

rmdir "~"

For your other question (better to create a extra question for it) total means the total file size of the directory (sum of the file sizes in the output). If you use -h it will show you the size in a human readable format.

ls -lh


You can form the directory name in such a way so that the shell doesn't expand it. mru's answer will work. So will prepending "./" to it (i.e., indicating current directory), or specify the full path, e.g., rmdir ./~.


Enter the tmp directory and enclose the ~ in quotes. It will not expand to your $HOME.

rm -r "~"

The "4" is the size of all files in the directory. If you perform ls -lh, it will print it in human readable format.

# ls -l                                                                               
total 1272
-rw-rw-r--. 1 me me  33222 May  8 18:02 untangle.dmp
-rw-rw-r--. 1 me me 426780 May  8 17:15 new.orig.dmp
-rw-r--r--. 1 me me 425195 May  8 15:40 repos.orig.dmp
-rw-rw-r--. 1 me me 407823 May  8 18:02 blah-untangle.dmp
# ls -lh                                                                              
total 1.3M
-rw-rw-r--. 1 me me  33K May  8 18:02 untangle.dmp
-rw-rw-r--. 1 me me 417K May  8 17:15 new.orig.dmp
-rw-r--r--. 1 me me 416K May  8 15:40 repos.orig.dmp
-rw-rw-r--. 1 me me 399K May  8 18:02 blah-untangle.dmp

Also, please don't cross post.