Linux Command - rm

rm - remove files or directories.

Syntax

1
2
rm [OPTION] FILE...

Description

rm removes each specified file. By default, it does not remove directories.

Option Description
-f, –force ignore nonexistent files, never prompt
-i prompt before every removal
-r, -R, –recursive remove directories and their contents recursively
-v, –verbose explain what is being done

Example

Remove file(s)

1
rm log1

To remove multiple files

1
rm log1 log2

Prompt before removing a file

1
rm -i log1

Remove a directory

1
rm -r dir

Reference