When I select the file and push delete this file is automatically landing in the trash. How can I delete files bypassing trash without using a mouse?
Ubuntu – How to delete files bypassing trash
nautilustrash
Related Solutions
Part One
We will change the attributes of the trashed files so only root can change it back and eventually delete then.
1) Edit /etc/rc.local to looks like this:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing # but desgua has changed it # to keep a copy of trashed files while [ "$var1" != "end" ] do sudo chattr +i /home/user_name/.local/share/Trash/files/* sleep 2 done exit 0
4) Make it executable.
sudo chmod +x /etc/rc.local
5) Reboot or logout and log back in.
ps-1: just to take it easy with the processor the attribute change is made every 2 seconds. You may change that as you like.
ps-2: to remove the attribute "i" (immutable) just execute:
sudo chattr -i /home/user_name/.local/share/Trash/files/*
Part Two
To disable bypassing trash.
1) Open gconf-editor.
gconf-editor
2) Go to /apps/nautilus/preferences/enable_delete right click on it and "Set Mandatory".
Part Three
Disabling Shift + Del
We will mod keymap.
1) Create a file
nano ~/.Xmodmap
2) Paste this and save:
keycode 119 = Delete BackSpace
obs.: use "xev" to check if you keyboard Del really is "keycode 119"
3) We sure don't want this file to be deleted, so:
sudo chattr +i ~/.Xmodmap
5) Reboot, logout or execute:
xmodmap ~/.Xmodmap
Now done!
- last edit 04/07/2011
When nautilus trashes something, it doesn't want to have to move it across partitions. This is because it takes a lot longer to move between partitions, and then if you remove the partition then the trash has no place to restore to.
Anywhere that is on the same partitions as your home directory is sent to ~/.local/share/Trash
. This works across the entire root partition on setups which only have one partition.
On any other partition nautilus will make a .Trash-1000
folder on the root of the partition, then send all trashed files into that. This works rather well on external drives that you have full read/write access to, though it won't work if you don't have write permission to the root of the drive.
Because your /
partition isn't the same as your /home
partition, and a .Trash-1000
doesn't exist with write permission at the root of your system, nautilus will fail to trash files. Thus the delete key won't work and a trash action won't be available in the menus.
You could try using a root nautilus and deleting one file so that the /.Trash-1000
folder is created correctly, then using sudo chmod -R 777 /.Trash-1000
to give yourself permission to access a trash on the /
filesystem. I cannot confirm that this will work though you could give it a try.
Best Answer
Select the files and leave SHIFT pressed while pressing the DELETE button or option.
Example: Select with CTRL several files while clicking on them.
Leave SHIFT pressed while pressing the DELETE button will delete them permanently.
To select multiple files. Click the first file and then leave SHIFT pressed while selecting the last file you want to select. It is the same thing as dragging the mouse while pressing the left mouse button.