---linux delete files or directories command using Linux under RM command
Users can use the RM command to delete unwanted files. The function of this command is to delete one or more files or directories in a directory, and it can delete all files and subdirectories under a directory. For linked files, only the link is broken, the original file remains unchanged.
The general form of the RM command is:rm [Options] ... Directory... Deletes the specified < file > (that is, unlink).
-D--directory Delete directories that may still have data (super users only)
-F--force Skip files that do not exist, do not display any information, force delete
-I--interactive must confirm before any delete operation
-R/R--recursive Delete all directory tiers in this directory at the same time
-V--verbose detailed display of the steps performed
--HELP Display this help message and leave
--version display version information and leave
PS1: The best use of the command is RM-RF <filename>, OK to delete, change the command whether it is a folder or file will be directly forced to delete.
PS2:RM simultaneously delete multiple files command: RM <filename1> <filename2>
To delete a file with the first character '-' (for example '-foo '), use one of the following methods:
rm ---Foo
rm ./-foo
Note that if you use RM to delete a file, you can usually still restore the file to its original state. If you want to make sure
The contents of this file cannot be restored, please consider using shred.
Example:
Delete all RB language programs; Ask for confirmation before deleting:
RM -I *.RB
Delete all the files in the finished subdirectory and subdirectories:
Rm-r finished
Delete all files in the finished subdirectory and subdirectories, and do not-confirm:
Rm-rf finished
The RM command in Linux is detailed