However I am aware of another command, rmdir, which seems to do the job just as well:
rmdir myDir
What is the difference between these two commands and when should each be used?
Best Answer
rm -r removes a directory and all its contents; rmdir will only remove a directory if the directory is empty. I like to use the following to remove a directory and all its contents:
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.
Best Answer
rm -r
removes a directory and all its contents;rmdir
will only remove a directory if the directory is empty. I like to use the following to remove a directory and all its contents: