When you install any programs with root access on Linux-based operating systems, you may receive a Permission Denied error if you try to delete the remaining files or folders, and as a result, you cannot delete the file or folder.
How to Delete an Undeleted File or Folder in Linux
For example, you are using the Linux Mint or Ubuntu operating system, and you have created a new file/folder on the desktop. Since you are logged in to the system with a non-root user, you can easily delete the file/folder you created.
However, in some cases, when you install a program that requires root access, you may encounter files and folders that cannot be deleted anywhere or on the desktop. Therefore, when you try to delete these files and folders normally, you will receive a Permission Denied error.
On Linux, you can use Terminal to delete such files and folders that cannot be deleted. You can delete files that cannot be deleted using the Linux RM command by switching to Root in the Terminal.
How to Remove Files and Folders by Using Terminal on Ubuntu, Debian, Linux Mint, Kali Linux
We will use the Linux RM command to delete an indelible folder that we encountered on Linux Mint 18/19. On Linux, you can delete files, directories, and folders using the RM command.
To delete undelete files on Linux or delete folders, follow the steps below.
As you can see in the image below, there is a folder on Linux Mint that cannot delete. When you try to delete it normally, you will receive a Permission Denied error.
Try to delete the vmware-tools-distrib folder as follows.
You will receive a Permission Denied error as in the image below.
Open the Terminal on Linux and execute sudo su to access Root, then type your root password and press Enter.
On Linux, you can use the ls command to display the directory in your current location. To delete the undeleted folder, execute rm -rf vmware-tools-distrib.
rm -rf vmware-tools-distrib
As soon as you execute the rm -rf vmware-tools-distrib command, you can see that the folder has deleted.
Deleting a File That Cannot Be Deleted ⇒ Video
To delete an undeletable file or folder on Linux Mint 18/19, you can watch the video below and also subscribe to our YouTube channel to support us!
In this article, we have examined step by step on how to delete permission denied files or folders. Thanks for following us!