How to delete an entire directory via SSH

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

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks
  • LinkedIn
  • Reddit
  • Tumblr
This entry was posted in IT & Administration, Web & Software Development and tagged , , , . Bookmark the permalink.

14 Responses to How to delete an entire directory via SSH

  1. David Nunez says:

    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

  2. rap says:

    This is workiiiiiing. Thanks.

  3. Dude says:

    Finally thanks!!!

  4. andre says:

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

  5. Dimitris says:

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

  6. Kraig says:

    It worked. Thanks.

  7. Humberto says:

    Totally worked, thanks so much!

  8. George says:

    LOVE IT ! Thanks guys !

  9. Tim says:

    Previously removing a magento installation via FTP = FAIL.

    Currently removing a magento installation via SSH = WIN.

    You sir, are a legend.

  10. Robbie says:

    I googled and I found. Therefore I am.
    Thanks for the tip for the non-linux geek.

  11. Paul says:

    Thanks man. I’m enjoying the power of SSH. saves me time.

  12. kristen says:

    thanks! googled it and found you 1st.

  13. Mayank says:

    Works! Thanks. but can anybody tell me why its slow.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>