rm

>Usage

The rm command is used for deleting or removing file or directories.

By default, it does not remove directories but with some options like -r it can also delete them.

This command doesn't give an output but it generates a message in case of an error.

>Synopsis

rm [option] file/directory

>Options

-v

This option gives a message for each file or directory you delete.

Example:

Dots

-zsh

> rm -v file_1


file_1

-r

This option is used for deleting a directory and all the files or subdirectories inside of it.

Assume that you want to delete a directory called dir_1 and the files that are inside of it called file_1 and file_2:

Example:

Dots

-zsh

> rm -vr dir_1


dir_1/file_1
dir_1/file_2
dir_1

-i

By using this option you have to give confirmation before deleting a file. Press y to confirm, press n to negate.

Example:

Dots

-zsh

> rm -vi file_1


remove file_1? y
file_1

>Quiz

Progress: Question ? out of ?

Question Title

Page written by Gabriele Siliprandi