I don't remember exactly how this directory got created. It's name is ~, the alternative we all use for home diretory. I also see a sticky bit attached with this directory. How shall I delete it? I fear running a normal rmdir would delete all the files from the home directory recursively. Here are the details :

mtk4@laptop:~/temp$ ls -l
total 4
drwxrwxr-t 2 mtk4 mtk4 4096 Oct 17 2011 ~

How shall I proceed?

Another question : What does the total number specify on the first line of output of ls -l ? '4' in this case. There is just 1 directory as shown(other than . and ..).

I am using ubuntu 12.04.

Also asked same question on askubuntu, as it seems to be relavant on both sites.

  • 2
    rmdir isn't capable of recursive deletion - you need rm with the -r flag for that. May 17 '12 at 18:21
  • rmdir \~ .....
    – Toothrot
    Dec 18 '19 at 13:33

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.

  • Thanks a lot. Double quotes worked. I didn't know about the cross-posting. Will be careful next time, to post only on the most relevant site. Also deleting the duplicate post of mine. Thanks :)
    – mtk
    May 17 '12 at 18:15

Standard solution: rm ./-

Not-so-standard solution: rm -- -

Explanation: rm (and many other commands) takes strings starting - as options, not file names. By stating the name as ./- the argument doesn't start - anymore, and is taken as a file name. Not-so-standard is that many programs (particularly GNU ones) recognize -- as "end of options", so the lone - loses any optiony meaning, and must be a file name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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