How Do You Force Delete a File in Linux?
Contents

Open the terminal application on Linux. The rmdir command removes empty directories only. Hence you need to use the rm command to remove files on Linux. Type the command rm -rf dirname to delete a directory forcefully.

How do you force delete a file that won’t delete?

Method 1. Force to Delete a File That Cannot Be Deleted Windows 10

  1. Go to Start, type Task Manager, and choose “Task Manager” to open it.
  2. Find the application that is currently using the file, and select “End task”.
  3. Then, try to delete the file again on your Windows PC.

How do I force delete a file in Ubuntu?

To get rid of stubborn files, first try using the Terminal to run a direct root-level delete command on the file:

  1. Open the Terminal and type this command, followed by a space: sudo rm -rf. …
  2. Drag the desired file or folder to the terminal window.
  3. Press enter, followed by entering your password.
Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest