The Linux rm command is used to delete a file or directory.
Syntax
Rm [options] name...
Parameters:
-I ask for confirmation one by one before deletion.
-F the original file is deleted directly even if its attribute is set to "read-only". You do not need to confirm the attribute one by one.
-R also deletes directories and the following files one by one.
Instance
You can use the rm command to delete a file. If you delete a directory, you must use the "-r" option. For example:
# Rm test.txt rm: Do you want to delete the general file "test.txt "? Y # rm homework rm: the "homework" directory cannot be deleted: it is a directory # rm-r homework rm: Do you want to delete the "homework" directory "? Y
Delete all files and directories in the current directory. Command behavior:
Rm-r *
Once the file is deleted using the rm command, it cannot be recovered. Therefore, you must use this command with caution.