How to delete locked files or folder in Linux

How to delete locked files or folder in Linux

How to delete locked files or folder in Linux

If you try to delete a file or folder in Linux but it is not deleting and you are getting an error like "permission denied" etc.

Then today in this post I will show you how you can easily delete the file or folder in Linux which is locked.

So follow the method below.

Delete locked files or folders in Linux

To delete the locked files or folders in Linux, follow the steps below:-

1. First of all open the Terminal on your Linux.

2. Make sure you are running the Terminal as root, if not then type sudo su command in the Terminal.

3. Now after that, type the rm -rf command on the Terminal and then type the location of the folder or files you want to delete.

For Example, if you have that folder in the Desktop and the name of the folder is Test, then in the terminal type the following

rm -rf (the location of the folder) which will look like this rm -rf '/home/Linux/Desktop/Test'

and then press enters, now the folder will be deleted permanently.

4. So in  the same way if you have a file that is not deleting, then open Terminal as root again and type the following

rm -rf (your file)

you can type rm -rf and can drag that file or folder on the terminal to paste the location quickly.

now press enters to delete that file.

5. Using the rm -rf command you can delete any locked files easily.

So in this way you can delete any locked files or folders in Linux. 

If you still have any questions then you can ask in the comment section below.

Keep visiting QasimTricks for more content like this.