Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

One thing I really hate about Ubuntu is how easy it is to accidentally delete files.

Is there any way to show a pop-up confirmation dialog when the Delete key is pressed, before a file is actually moved to the trash?

share|improve this question
    
It does ask if you Shift-Delete something (permanently). It's only reversible deletes that are not queried. –  ams Dec 22 '11 at 13:43

2 Answers 2

Graphical

Nautilus there is. Right click a file and move it to trash or deleting files.

enter image description here

Command line

The command line add a few aliases in ~/.bashrc

# Command line
nano ~/.bashrc

# Graphical
gedit ~/.bashrc

Add a few aliases and activate noclobber

alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'

set -o noclobber # Override >|

No clobber prevents you from redirecting and overwriting to an existing file.

So echo 'add this' > file not over write a file if it exists. You can still append echo 'add this' >> file. You can over ride it by adding a "|" echo 'add this' >| file

Delete key

I do not know any way of over riding the delete key. You may be able to map the delete key to a script, but, as I would assume you would use the delete key for other tasks, you would then map a key combination to perhaps a zenity script.

Perhaps someone else will add a way to over ride the delete key.

share|improve this answer
    
The entire question is about confirmations when accidentally pressing the Delete key though... –  Mehrdad Dec 22 '11 at 0:43
    
You're going in the wrong direction, bodhi. The OP wants a way to add an extra confirmation message to stop things automatically going to the trash. Not remove confirmations. –  Oli Dec 22 '11 at 0:58
    
I think I posted too fast, updated. @Oli - do you know an easy way to add the desired function to the delete key ? –  bodhi.zazen Dec 22 '11 at 4:33

The lack of an option for this is a result of the Gnome philosophy of striving for simplicity at the expense of easy customisation.

I would recommend switching to another file manager which has this option, like Dolphin or Thunar.

enter image description here

The default file manager is also difficult to configure in Gnome, but there are instructions to do so on the Ubuntu wiki.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.