Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
2  
rmdir isn't capable of recursive deletion - you need rm with the -r flag for that. –  Nathan Osman May 17 '12 at 18:21
add comment

3 Answers

up vote 5 down vote accepted

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

share|improve this answer
add comment

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 ./~.

share|improve this answer
add comment

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

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

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