In Linux, the main command used to delete files in folders is rm. The following describes how to delete linux rm.
Syntax:
Rm [Option] DirName
The [Options] In this command are commonly used in the following ways:
-I ask for confirmation one by one before deletion
-F the deleted object is directly deleted even if its attribute is read-only. You do not need to confirm it one by one. By default, the object needs to be confirmed one by one.
-R: delete directories and all the following files one by one.
Example:
Rm-I *. php deletes all documents suffixed with php. Ask for confirmation one by one before deletion.
Rm-r phpernote: delete all the files in the phpernote directory and subdirectory. When the file is read-only, a message is displayed indicating whether to delete the file.
Rm-rf/var/access will delete the/var/access Directory and all files and folders under it. No confirmation prompt will be sent when you delete the directory.
Note:
(1) There is no recycle bin in linux, so when using the rm command, remember that the files or directories cannot be restored after they are deleted.
(2) If you are prompted that you do not have the permission to run the command, you can use sudo to escalate the user's permission and then execute the command.
Articles you may be interested in
- Linux chmod (file or folder permission setting) command parameters and Usage Details
- Linux File Content statistics command wc command usage details
- Create a folder (mkdir) command in linux
- Php clears (deletes) the files in the specified directory, and does not delete the directory folder.
- Summary of linux Command for viewing File Content
- How many lines of files can be viewed in linux?
- Linux File Creation (touch) command details
- Linux Command file directory management cat command