Get the App
SLTechnology News&Howtos  ›  Servers  › 

Development without rm-rf / * is not good for operation and maintenance.

Shulou Source: shulou.com Published: 2022-06-02 06:57:31 10月05日 Update

It takes about 1 minute to read this article.

Open the terminal, get root permissions, and execute the following command: rm-rf / *. What happens? It is estimated that as long as people who have come into contact with Linux, they must have heard a lot about it and know what terrible things will happen after that.

Popular science, run the command in the Linux system, the system will faithfully execute the command, even if the result is to delete itself, do not execute the secondary command in the production environment, otherwise there is no regret medicine to buy!

Delete command for "rm" Linux system

A parameter under the "- r" rm command that refers to recursive deletion

A parameter under the "- f" rm command that forcibly deletes

"/ *" / 'represents the system root directory, and' / * 'represents any file under the system root directory

1. During the execution of the command, some errors will be reported, indicating that files with special permissions cannot be deleted (protected by the system, perhaps I permission), but this will not hinder the execution of the command.

two。 After executing the command, the commands such as top, free, ls, etc. used in the terminal will be invalid, the / bin directory will also be delete, and only cd will be available.

3. In addition, the Linux system will not shut down properly, and the commands related to the shutdown operation have also been deleted.

4. After the forced shutdown, try to boot again, can not enter the system normally again, can only reinstall the system.

Judging from the above results, even the basic commands cannot be executed, so the user data (such as installed software, deployed websites, databases, etc.) must have been deleted.

Therefore, we should form a good habit in the process of operation, try not to use the rm command, use the mv command instead. For example, to delete the abc.txt file, execute mv abc.txt / temp, and then write a script to regularly clean up the files in the / temp directory, which is much safer.

END

The growth path of programmers

Although it is a long way to go, it will come.

This article was originally posted on the Wechat official account "the way programmers grow up" and replied "1024". You know, give me a like.

Wechat ID:cxydczzl

A wonderful review of the past

Programmers take advantage of seven platforms for private work.

The growth path of Java programmers

Why does vernacular TCP need three-way handshake

50 details of Java performance Optimization (Precious Edition)

Design the coupon system of e-commerce platform

A conversation makes you understand what an architect does.

Teach you a coquettish operation to improve efficiency with IDE programming!

A gift package of classic e-books for programmers

Tags: Commands systems programs programmers files permissions again parameters platform data root directory directory terminal result process path affirmative terrible clear special Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn OPPO Reno Shulou Technology Docker Huawei