The rm
command is used to remove files or directories in Unix-like operating systems. It stands for “remove”.
rm [OPTION]... FILE...
-f, --force
: Ignore nonexistent files and arguments, never prompt.-i
: Prompt before every removal.-I
: Prompt once before removing more than three files, or when removing recursively.-r, -R, --recursive
: Remove directories and their contents recursively.-d, --dir
: Remove empty directories.--help
: Display help information and exit.--version
: Output version information and exit.Remove a file:
rm filename
Remove multiple files:
rm file1 file2 file3
Remove a directory and its contents recursively:
rm -r directory
Force remove a file without prompting:
rm -f filename
Prompt before removing each file:
rm -i filename
Be very careful with the rm
command, especially with the -r
and -f
options, as it can delete important files and directories permanently.