Linux rm

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Linux rm | Linux Delete File

The 'rm' means remove. This command is used to remove a file. The command line doesn't have a recycle bin or trash unlike other GUI's to recover the files. Hence, be very much careful while using this command. Once you have deleted a file, it is removed permanently.

Syntax:

  1. rm <filename>  

Example:

rm myfile1  

rm file

In above snapshot, we have removed file myfile1 permanently with the help of 'rm' command.


rm Options

Option Description
rm *extension Used to delete files having same extension.
rm -r or R To delete a directory recursively.
rm -i Remove a file interactively.
rm -rf Remove a directory forcefully.