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
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
Good tip! 🙂
This is workiiiiiing. Thanks.
Finally thanks!!!
oh finallyyyyyyyyy.
thank you so much. I’ve tried numerous dif things and only this has help. Its a load off thanks.
Nice 🙂 Kudos for this, have been googling it 😉
It worked. Thanks.
Totally worked, thanks so much!
LOVE IT ! Thanks guys !
Previously removing a magento installation via FTP = FAIL.
Currently removing a magento installation via SSH = WIN.
You sir, are a legend.
I googled and I found. Therefore I am.
Thanks for the tip for the non-linux geek.
Thanks man. I’m enjoying the power of SSH. saves me time.
thanks! googled it and found you 1st.
Works! Thanks. but can anybody tell me why its slow.
Thanks! Keep up the good work!
yes, thanks, worked perfectly!
Cool, thanks bro.
Eternal gratitude – sometimes it seems the simplest things are the hardest to find answers to.
kudos for this! 😀 you’ve safe my day 🙂
Thank you! So lovely not to have to read loads of tech-speak before finding the simple answer 🙂
Hey, why are you on google’s top search results? It could be because you are awesome!
TNX! helped me a lot.. 🙂
Well, not exactly via SSH but actually via the shell… not the same thing at all…
And just in case, for those who might not know, be VERY careful with the -rf option, if you run it against your root directory you will end up in big trouble 🙂
anyway, keep it up!
I have to delete many files. So its always disconnect before finished.
what command to prevent it?
Haha! And it is so coincidental that I TOO use NFSN as well! Just did a search for “SSH command to remove full directory” and this was the top one. EXCELLENT.
I keep a file in a “my docs” folder in both Win and Linux (Ubuntu 11.10 currently) with a list of oft use linux commands because I really can’t recall them and I certainly don’t want to make a mistake with command line, especially if I do a dd type command! 😀
ADD-ON
Forgot to mention, when I am in Win XP I am using WinSCP and it’s a great “Commander” type interface, but I noticed when I deleted a WordPress directory within WInSCP it took FOREVER. I was sure doing it directly via SSH would be quicker, so next time I deleted a CMS directory I tried this method and VIOLA! Gone in 60 seconds.