BASH Programming by Patrik

How to delete a file in bash

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.
Bash

Comments

Leave a Comment

All fields are required. Your email address will not be published.