linux rm

Removing a file

rm 1.txt

Removing more than one file at a time

$ rm b.txt c.txt

remove a directory

rm –r sundar/

delete a file particular directory

rm –r /tmp/test

Options: 1. -i (Interactive Deletion): Like in cp, the -i option makes the command ask the user for confirmation before removing each file, you have to press y for confirm deletion, any other key leaves the file un-deleted.

$ rm -i d.txt

rm: remove regular empty file 'd.txt'? y

-f (Force Deletion): rm prompts for confirmation removal if a file is write protected. The -f option overrides this minor protection and removes the file forcefully.

rm -f e.txt