If I am logged in as root in a linux system and I run command rm -rf on / folder, should it remove all the files? also the kernel?
Just curious about it :P
|
If I am logged in as root in a linux system and I run command rm -rf on / folder, should it remove all the files? also the kernel? Just curious about it :P | |||
|
feedback
|
This question came from our site for professional and enthusiast programmers.
|
Looks like the result will depend on the distro. See: Try it yourself (in a VM) :) | |||
|
feedback
|
|
Yes it would, some systems have protection against it though, like Solaris 10. | |||
|
feedback
|
|
I wouldn't try this unless you plan on pulling out all of your hair later. | |||||
feedback
|
|
It may or may not remove every file, but unless the OS is filtering it, chances are you'll end up with an effectively unusable system. In particular, you probably won't be able to remove files or devices that are in use at the time you execute the command. If your goal is to completely hose a running system, this should do the trick. If you actually want to delete everything on the disk, you should boot from a different device such as a LiveCD or a USB drive and then have your way with the target disk. If you are doing this because you don't want to leak confidential/sensitive information, I would suggest something like Darik's Boot and Nuke instead of playing around with "rm". If you just want to start again with an empty disk, instead of "rm", I would just make a new filesystem on that block device. This will be much faster than an "rm" on an entire filesystem or multiple filesystems. | |||
|
feedback
|