
I help out a bunch of folks with Ubuntu machines who are not exactly Linux savvy but who are learning quick.
The most interesting and dangerous phase of this learning experience is when the start mucking about in the Command Line Interface (CLI). It’s exciting for them to suddenly feel powerful on their own computer. They can make sweeping changes with the tap of a few keys.
Sadly, they do this. A lot.
Before they really know what they’re doing. So I’ve implemented a few quick changes to their machines to always prompt before removing, copying or moving files.
When they know enough about their system, they can change it back. As you may have guessed, I’m not a paid admin to any of them.
Does this foolproof their systems? No, but it does add an extra layer of though (I hope) to their actions. One of my biggest problems with users is making changes to or removing key files without backing them up.
Here’s what you do. Fire up a CLI session yourself. We’re going to edit your bash.bashrc in the /etc directory to tell it to always prompt before removing a file. First, we’re going to back it up.
sudo cp /etc/bash.bashrc bash.bashrc.bak
Now let’s fire up gedit and make some changes.
gksudo gedit /etc/bash.bashrc
Skip down to the bottom of the file and add these three lines.
alias rm=’rm -i’
alias cp=’cp -i’
alias mv=’mv -i’
The -i switch will cause these programs to execute interactively. This means they’ll prompt before acting.
Popularity: 1% [?]












January 18th, 2007 at 11:08 am
Great tip.
But how can I have linux to prompt me before deleting a file in the graphical environment (Nautilus)?
January 18th, 2007 at 11:25 am
Hey Mike,
Well, you have two options in Nautilus.
1. Send it to the trash. This way, it’s not gone until you empty your trash. You can go into Edit-> Preferences in any Nautilus window. Then go to the Behavior tab where you can control how Nautiuls handles warning you about both sending a file to the Trash, and then emptying the Trash.
2. If you include a Delete command that bypasses the trash, you get no warning/prompt/bells/whistles. So use this with caution or uncheck it if it bothers you or is a danger to some users.
March 14th, 2009 at 8:49 am
I must say, that I can not agree with you in 100%, but that’s just my opinion, which could be wrong.
p.s. You have an awesome template for your blog. Where did you find it?
May 17th, 2010 at 3:54 pm
Sau gut! Endlich mal jemand der meiner Meinung ist.
November 8th, 2010 at 3:26 pm
I’d come to give the go-ahead with you here. Which is not something I typically do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!
November 16th, 2010 at 12:20 pm
Wow, It has been quite a while needed to take some notes on. Well another article that will work out just fine. I need something like this just finishing up, and it is on the same topic as this post. Glad, great share.
November 17th, 2010 at 1:40 am
Useful post, this is. It is definitely great to see a post that is valuable.
June 18th, 2011 at 8:47 am
For the quarter ended June 30, 2009, the Company’s revenues were $22.6 million, an increase of 71.2% year-over-year from $13.2 million in 2Q2008.