The Linux geeks talk about the Linux file system structure its benefits and advantages over other operating system file systems etc. The Linux uses the root or / as the file system root and layout files and folders under this in a structural manner. Linux mostly used with commands like mkdir, rm, etc. But you may ask what will happen if I try to delete everything under the root directory or path?
Try To Delete with “sudo -Rf /” Command
The “sudo rm -Rf /” command seems very dangerous where it can delete everything on the local system from binaries to configurations to user files to web applications etc. But the important question is that what will happen then the binaries like bash shell, mkdir command, ls commands, desktop environment executables are deleted?
$ sudo rm -Rf /
Interestingly this command will not work as expected and print the following output.
rm: it is dangerous to operate recursively on '/' rm: use --no-preserve-root to override this failsafe
This output simply says that rm is dangerous to operate recursively on the root directory and this command is not executed. By default the rm command has the –no-preserve-root option in order to disable root directory preservation.
Delete Root and All Files System with –no–preserve-root Parameter
If you really determined to delete the root file system and directory with all data and binaries you will use the –no-preserve-root option for the “sudo rm -Rf /” command like below.
$ sudo rm -Rf --no-preserve-root /
This command will start to delete everything on the all mounted files systems by starting from the root file system. First you will see some errors about failed delete operations and then the following screen will be provided by crashed desktop environment like KDE, GNOME, XFCE etc.
When you restart the system you will see the following BusyBox screen which will be loaded after boot because the root file system is corrupted and the Linux operating system and Desktop environment can not be loaded properly.