Home >Operation and Maintenance >Linux Operation and Maintenance >How to delete all files in linux
In Linux, you can use the rm command to delete all files. This command is used to delete a file or directory. The syntax is "sudo rm -rf /*"; using the "sudo rm -rf /*" command will Delete all computer files including system files.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to delete all files in Linux
If you want to clear all files on the entire computer, then enter: [sudo rm -rf /* 】Press the Enter key, then the entire computer file will be cleared. Do not execute this command on the server or system, otherwise the system will be deleted.
After waiting for the command to stop, the entire desktop file will be cleared. Then garbled characters are displayed. If you want to reinstall the system, you can execute this command.
Examples are as follows:
sudo uses administrator privileges to run a command
rm Delete command, for example
rm 1.txt
means to delete the file 1.txt in the current directory
-rf is the parameter of the rm command
r means recursive deletion
f means force (used to skip the confirmation step of the rm command)
So rm -rf means deleting a directory
/* is actually the directory
/ represents the root directory. The Linux file system is a tree structure, and / is the root of the tree. All folders and files are child nodes of this root. Or descendant node
* means matching everything, which means everything in the / directory. Because of the forced recursive deletion mentioned above, this command will eventually start from the root directory and delete everything in the Linux system. Things, because everything in the Linux system is a file, that is to say, whether it is system commands, system status, system interrupts, etc., they are all files, and because all files are in the descendant nodes of /, this leads to This command directly deletes itself
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to delete all files in linux. For more information, please follow other related articles on the PHP Chinese website!