Search code examples
fileterminaldirectoryrmrmdir

How to remove files and directories quickly via terminal (bash shell)


From a terminal window:

When I use the rm command it can only remove files.
When I use the rmdir command it only removes empty folders.

If I have a directory nested with files and folders within folders with files and so on, is there a way to delete all the files and folders without all the strenuous command typing?

If it makes a difference, I am using the Mac Bash shell from a terminal, not Microsoft DOS or Linux.


Solution

  • rm -rf some_dir
    

    -r "recursive" -f "force" (suppress confirmation messages)

    Be careful!