Whenever you plug a USB flash drive or an external hard drive into an Ubuntu Linux machine and delete a file using the graphical file manager (Nautilus), Ubuntu does not actually erase the file. Instead, it moves the file into a hidden directory on the USB drive named .Trash-1000 (the number corresponds to your user ID).
While this is a great safety net for accidental deletions, it becomes incredibly annoying if you move the USB drive to a Windows or macOS machine, only to find that your drive is completely full because gigabytes of “deleted” files are hiding in a folder you can’t easily see.
If you want deleted files to be permanently erased from removable media immediately, you have two distinct options.
Option 1: Use the “Permanent Delete” Shortcut
Instead of disabling the trash feature entirely, you can simply change your personal workflow by bypassing the trash can when you delete files.
- Open your USB drive in the Ubuntu file manager.
- Select the file or folder you want to delete.
- Instead of pressing the “Delete” key on your keyboard (which moves it to the Trash), press Shift + Delete.
- A popup will ask you to confirm that you want to permanently delete the files. Click Delete.
This method prevents the .Trash-1000 folder from filling up, but requires you to remember the keyboard shortcut every time.
Option 2: Prevent the Creation of the Trash Folder
If you want to ensure that Ubuntu can never create a trash folder on a specific USB drive, you can use a clever trick involving file permissions.
- Plug your USB drive into your Ubuntu machine.
- Open your terminal application (
Ctrl+Alt+T). - Navigate to the mount point of your USB drive (usually located in
/media/your-username/drive-name). - Create a blank text file named exactly
.Trash-1000by running the following command (replace the path with your actual drive path):
touch /media/username/USB-DRIVE/.Trash-1000
- Now, you need to lock this file so the operating system cannot modify it or turn it into a folder. Remove all write permissions from the file using this command:
sudo chmod 000 /media/username/USB-DRIVE/.Trash-1000
Because a locked file named .Trash-1000 now exists on the root of the drive, Ubuntu’s file manager will be completely unable to create a hidden Trash folder with the same name. Whenever you press the standard “Delete” key on this drive in the future, Ubuntu will realize it cannot access the trash and will immediately prompt you to permanently delete the file instead.