Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the meaning of the "rm-rf / *" command executed on SSH

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the meaning of the "rm-rf / *" command executed in SSH. It is very detailed and has a certain reference value. Interested friends must finish reading it!

Friends who often visit the VPS host exchange forum can see that when users post to ask questions related to the command, individual mischievous users will answer to execute "rm-rf / *" in SSH. If you do not understand this command, all files in the entire Linux system may be deleted.

This delete command can only be executed by accounts with "root" permission, and other accounts that do not have "root" permission can only delete files belonging to their own users or user groups.

The directory of Linux is stored in the form of /, rm is the delete command of Linux, followed by "- rf", "- r" refers to recursive deletion (meaning to delete all files and folders in the current directory), and "- f" refers to forced deletion. The trailing / * refers to all files under the root directory "/".

Then, if you perform a forced recursive delete under the / directory, the command deletes all system directories, including / home, / sbin, and so on, without any prompt.

Rm-rf / *

Please do not execute the above commands at will, otherwise the entire Linux system will be deleted.

We create a directory an in the root directory and a b file and c file in the a directory

Use # rm-rf / a to see what the effect is.

The command # rm-rf is fine because it is a command that deletes an entire directory.

Then we delete / delete /

It will give you a hint here, so you don't usually misoperate. What is said on the Internet is that version 7 added this prompt, so those below 7 should be careful!

However, / * will be carried out directly.

Although all of them cannot be deleted.

But it still works, that is, some commands can't be used.

But shouldn't it have crashed immediately? How can I still operate it? Anyway, let's restart it and see what happens.

Well, it looks like it's dead.

Therefore, rm is not recommended, use mv to move files to / delete/, and then write a scheduled task to delete every month. It is equivalent to the function of a recycling bin.

The above is all the contents of the "rm-rf / *" command executed in SSH. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report