Linux rm -rf

Linux rm -rf command deletes directory forcefully. It means a file or directory will be deleted anyhow even if it has read-only permission.

To delete a file forcefully, use command:

To delete a directory forcefully, use command:

Let's see an example on how to delete a directory.

In the below picture, we have used command rm -r protected. As you can see this file has read-only access, hence it is asking for permission whether to delete or not. However, the file will be deleted after getting permission as shown below.

Linux rm -rf

But by giving command rm -rf it will delete that particular file having read-only access without asking for permission.

Linux rm -rf



Latest Courses