Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Just a simple question which I can't work out. Why, when people are deleting folders, do people always do it using rm -rf? I have done a few tests and rm -r always does it perfectly well.
According to rm --help, the 'f' option makes rm "ignore nonexistent files, never prompt". I assume by "nonexistent" it is referring to '.' and "..", but these seem to be removed automatically by rm -r.
There are some distributions that even ask you if your sure to remove a directory also the -r option is given. Namely redhat and centos. Dunno of any other distro though.
In RHEL, CentOS, Mandriva, PCLinuxOS you will have to say 'yes'
for every single file in a folder, if 'rm -r' is used.
Hence 'rm -rf'..
Is that because it's part of the system as a default or is it because "rm" gets aliased to "rm -i". I've seen a good number of systems that either do the alias trick or have rm move the file(s) to a .trash folder. Getting around either is fairly straightforward. Personally, I hate people having to rely on such tricks as it gives a false sense of security when they happen to be on a system that doesn't offer those same safeguards.
Checked it on Centos-6.3. There is an alias for rm to rm -i like you sad. And I totaly agree with you on the false sense.
Just for me to be sure I always first do a ls ./your_files_to*_delete and if the output only consists of files that I am sure about I arrow-up inside the history, ctrl-a to start of line, ctrl-d to erase ls and type rm. This makes sure one knows what gets deleted.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.