The “rm” command

Use this command to delete one or more files or directories.

Include one or more instances of the <FILE> variable, separating each with a whitespace, and set it to the complete path to be deleted. Each <FILE> variable can be either of the following:

  • End with a directory: This will delete it, as well as all of its associated contents. (This includes all sub-directories and file contents)
  • End with a specific filename: This will delete an individual file.
rm <OPTION>... <FILE>...

Example

In this example, a single file, as well as a complete directory are targeted for deletion:

rm --interactive /123456/test/movie_old.mp4 /123456/old/

Available options

Note: The “<OPTION>” variable displayed in the above example can be populated with any of the following options:
Option Description
-f, --force1 This is applicable if you have defined a list of separate <FILE> entries and one (or more) among them does not exist. The removal will continue without prompting you.
-i, --interactive 2 Ask before removing files.
-r, --recursive3 This option performs a "quick-delete" to remove content recursively.
-v, --verbose Display the operation’s execution step by step.
-h, --help Display help information for this command.
1 To use in conjunction with -r, quick-delete must be enabled.
2 If targeting a complete directory for deletion it is recommended that you incorporate “interactive” mode as an option, to avoid inadvertently deleting a wanted file. Additionally, when enabled, your confirmation response must begin with “ y” or “ Y”, otherwise the file will be skipped.
3 Review quick-delete considerations when using this option.