What is the linux rm command?
The Linux rm command is used to delete a file or directory.
Recommendation: “linux tutorial“
Grammar
rm [options] name...
Parameters:
-i Ask for confirmation one by one before deleting.
-f Even if the original file attribute is set to read-only, it will be deleted directly without confirmation one by one.
-r delete the directory and the following files one by one.
Example
You can use the rm command directly to delete a file. If you delete a directory, you must cooperate with the option “-r”, for example:
# rm test.txt rm: Do you want to delete the general file "test.txt"? y # rm homework rm: cannot remove directory 'homework': is a directory # rm -r homework rm: Do you want to delete the directory "homework"? y
Delete all files and directories under the current directory, the command line is:
rm - r *
Once the file is deleted by the rm command, it cannot be restored, so this command must be used with great care.
The above is the detailed content of the linux rm command. For more information, please pay attention to other related articles on 1024programmer.com!