How to delete an entire directory via SSH

March 31, 2008
Categories: IT & Administration, Web & Software Development
Tags: , ,

I know this is probably common knowledge to Linux and Unix geeks. But every time I need to remove a directory with files in my NearlyFreeSpeech.Net SSH terminal I end up having to google for the command. So here it is for anyone else who’s out there googling!

rm -r -f YourDirectory

rm = remove / delete
-r = recursively deletes the directory and all files in it, including subdirectories
-f = will not ask for confirmation before deleting

  1. 9 Responses to “How to delete an entire directory via SSH”

  2. By David Nunez on Apr 12, 2008

    geek tip: you can save another TWO WHOLE KEYSTROKES by doing “-rf” not “-r -f”

    you can usually stack single letter options if they have no modifer ‘-rfaweqkv’ but you cant stack the “-u cool -p beans” or “–fullword” options

  3. By Dusty on Apr 14, 2008

    Good tip! :)

  4. By rap on Feb 20, 2009

    This is workiiiiiing. Thanks.

  5. By Dude on Mar 22, 2009

    Finally thanks!!!

  6. By andre on May 27, 2009

    oh finallyyyyyyyyy.
    thank you so much. I’ve tried numerous dif things and only this has help. Its a load off thanks.

  7. By Dimitris on Aug 3, 2009

    Nice :) Kudos for this, have been googling it ;)

  8. By Kraig on Oct 13, 2009

    It worked. Thanks.

  9. By Humberto on Nov 9, 2009

    Totally worked, thanks so much!

  10. By George on Jan 16, 2010

    LOVE IT ! Thanks guys !

Post a Comment