Home >Operation and Maintenance >Linux Operation and Maintenance >rm -rf /*What does it mean?
Friends who often visit VPS host exchange forums can see that when users post questions about commands, some users who want to play a prank will answer that they execute "rm -rf / in SSH" *", if you don't understand this command, it may cause the entire Linux system files to be deleted.
This deletion command can only be executed by accounts with "root" permissions. Other accounts that have not obtained "root" permissions can only delete files belonging to their own users or user groups.
Linux directories are stored in directories such as /. rm is the Linux deletion command, followed by "-rf" and "-r" refers to recursive deletion (meaning to delete the current directory all files and folders), while "-f" refers to force deletion. The trailing /* refers to all files under the root directory "/".
Then, if forced recursive deletion is performed in the / directory, the command will delete all system directories under / including /home, /sbin, etc. without any prompts.
rm -rf /*
Please do not execute the above commands at will, otherwise the entire Linux system will be deleted.
Related recommendations: "Linux Operation and Maintenance Tutorial"
We create an a directory in the root directory, and create a b file and c file under the a directory
Use # rm -rf /a to see what the effect is.
# There is no problem in using the rm -rf command normally, because it is a command to delete an entire directory.
Then we delete /
Here it will give you a prompt, so you generally won’t make a mistake. It is said online that this prompt was only added in version 7, so be careful if you are below version 7!
But /* will be executed directly.
Although all of them cannot be deleted.
But it still works, that is, some commands cannot be used.
But shouldn't it crash immediately? How come I can still operate it? No matter, restart it first and see what happens.
Well, it seems to have died.
Therefore, it is not recommended to use rm. Instead, use mv to move the file to /delete/year, month, day, and then write a scheduled task to delete it every month. It is equivalent to the function of a recycle bin.
The above is the detailed content of rm -rf /*What does it mean?. For more information, please follow other related articles on the PHP Chinese website!