Get the App
SLTechnology News&Howtos  ›  Servers  › 

How does linux delete all files

Shulou Source: shulou.com Published: 2022-05-31 14:16:56 09月14日 Update

Linux is how to delete all files, I believe many inexperienced people are helpless about this, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

In linux, you can delete all files using the rm command, which is used to delete a file or directory with the syntax "sudo rm -rf /*"; using the "sudo rm -rf /*" command will delete all computer files, including system files.

Operating environment: Linux 7.3 system, Dell G3 computer.

How Linux deletes all files

If you want to clear all files on the entire computer, then enter: [sudo rm -rf /*] Enter key, then the entire computer file will be cleared at this time. Do not execute this command on the server or system, or the system will be deleted.

After waiting for the command to stop, the entire desktop file is cleared. And then it shows garbled code. If you want to reinstall the system, you can execute this command.

Examples are as follows:

sudo runs a command with administrator privileges

rm delete command, for example

rm 1.txt

Delete the file 1.txt in the current directory

-rf is an argument to rm.

r is recursion deletion.

f means force (used to skip the confirmation step of the rm command)

So rm -rf means delete a directory

/* Actually, it's a catalog.

/represents the root directory, linux file system is a tree structure, and/is the root of the tree, all folders and files are children or descendants of this root node

* means match everything, meaning everything under/directory, and because of the forced recursive deletion mentioned above, this command will eventually delete everything in the linux system from the root directory, because everything in the linux system is a file, that is, whether it is a system command, system status, system interruption, etc., are files, and because all files are in the descendants of/, this command will directly delete itself.

After reading the above, do you know how linux deletes all files? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

Tags: Files commands systems directories computers content meaning instructions nodes things descendants that is methods more root directories problems recursion enforcement helplessness for this Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL Apple Shulou Technology NVidia