Examples of removing files with the rm command

To remove a single file:

   rm help.txt

This removes the file help.txt from the current directory.


To remove several files:

   rm artwork/figure[2-7]

This removes files figure2 through to figure7 from the subdirectory artwork.


To remove a file which you don't have write permission for:

   rm tmp/intro.txt
   rm: override protection 444 for intro.txt? y

This removes the file intro.txt from the subdirectory tmp. Because you don't have write permission for this file you are asked to confirm that you want to remove it. Entering a y removes the file, any other response leaves the file alone.


To remove files interactively:

   rm -i *.fm

This will prompt you to confirm that you want to remove a file from the current directory whenever that file has the suffix .fm.

Answering y will delete the file. The file is not deleted if any other response is given.


[Home] [Search] [Index] This site maintained by webmaster@softlab.ece.ntua.gr