rm

From Initq

Jump to: navigation, search

rm is short for remove and is used for deleting files.

Contents

-d

--directory removes a directory.

-f

--force never prompts the user and ignores missing files.

-i

--interactive always prompts the user.

-r

--recursive removes contents of all sub-directories.

There are three ways to do matching. *, ? and [].

 rm libby*.jpg

The above command will delete any file that begins with libby and ends with .jpg.

 rm libby1?.jpg

The above command will delete any file that begins with libby1, any one character that follows and ends in .jpg.

 rm libby1[12].jpg
 rm libby1[0-2].jpg

First command will delete file libby11.jpg and libby12.jpg. Second command will delete libby10.jpg, libby11.jog and libby12.jpg.

Personal tools