Delete the file using `rm
` command:
`rm
` command can be used with option and without the option for the different types of delete. The syntax of the `rm` command is given below.
Syntax:
$ rm [option] filename
Options
-i
’ option can be used with `rm
` command to provide a prompt before deleting any file to prevent accidental deletion.-f
’ option can be used with `rm
` command to remove any file forcefully.Remove a Single Folder
To remove a folder, which is empty, use the following command:
$ rmdir folder-name
Remove the non-empty folder
Use the 'rm
' command with the '-r
' option followed by the name of the folder to be deleted:
$ rm –r folder-name
In this command '-r
' flag refers to deleting all the contents of a folder first.