In a current directory, all files can be deleted by using rm command. The rm command removes the entries for the specified File parameter from a directory. If an entry is the last link to a file, the file is then deleted.

rm command

The rm command is a command line utility for removing files or directories. It is used to delete files and directories on Linux and other Unix-like operating systems.

The general syntax for rm command is  rm [options] [-r directories] filenames

The items in square brackets are optional. When just used with the names of one or more files, rm command deletes all those files without requiring confirmation by the user.

The following command deletes all the files f1,f2,f3 assuming that all three are located in the current directory rm f1,f2,f3

To delete all files in the current directory use the command rm*

Tagged in: