Tuesday, April 18, 2017

DELTREE (Delete Tree) on Linux

In Linux, there is a handy command to delete a directory with all files and sub-directories in it:
rm -Rf directoryname

Sometimes, some home built Linux needs the super user privilege. So, add the sudo command as the prefix.
sudo rm -Rf directoryname
The details of Linux rm -Rf directoryname command:
  • rm: remove files or directories
  • -R (recursive):  remove directories and their contents recursively
  • -f (force): ignore nonexistent files and arguments, never prompt
  • directoryname: the specific directory to be deleted
This is a very powerful command. So, use it with care.

No comments:

Post a Comment

How to kill an abandoned process in Linux/Unix

I remembered it, then I forgot, then I remembered it, and then I forgot again. In case of a Linux/Unit process hang, I have to figure out ...