The Linux Newbie Guide  ⇒    Fundamentals     Advanced     Supplement   Command Index   ENG⇒中
All rights reserved, please indicate the source when citing
  

rm - Remove Files




The rm  (remove) command is used to delete files or directories. The basic syntax is rm [OPTIONS] file1 file2 ..., where "OPTIONS" are optional command options, and "file1", "file2", and so on are the names of the files or directories you want to delete.

Common options include:

For example:
$ rm file ← Deletes a single file
$ rm file1 file2 ←Deletes multiple files
$ rm -r dir1 ←Deletes a directory and its contents
$ rm -ir dir1 ←Deletes a directory and prompts for confirmation for each file
$ rm goo* ← Deletes all files starting with "goo"


The rm command is powerful and should be used with caution, especially when using the "-r" option to avoid accidental data loss. More rm examples and explanations can be found at the following link.