After recently reading the article "8 Deadly Commands You Should Never Run on Linux", I've planned on somehow blocking/preventing/changing certain commands. I'm not worried that someone else will run destructive commands on my PC. I'm worried that I may be the culprit behind the accident.
I am worried about the commands listed below.
wget http://example.com/something -O – | sh –
- I've run this line when I was copying & pasting commands from a
guide. Had I noticed
sh -
, I'd have only run that after checking out the archive contents.
rm -rf /
- I accidentally hit the 'Enter' key a lot...
I want to prevent making these mistakes in the future. Is there a command/configuration file that can ensure I don't commit these mistakes? I do not want to be able to run the commands above even with sudo/root permissions. It it okay if the solution can be reversed.
Resources that will help me learn more about Ubuntu (excluding common Ubuntu Wiki/Help/etc. links) would be greatly appreciated!
Data loss isn't my main concern. I want to make the terminal a little safer for myself ('newb-proofed' if you will). This would be helpful to me as I've got lot's to learn. I've started school again, & I can't be spending too much of my time resolving problems/error (as interesting as it is).
Edit:
Is it possible to require specific commands to ask for confirmation? If I wanted to set specific commands to require a special password, can it be done?
sudo rm -rf /
will fail without adding--no-preserve-root
to the end. For these specific examples, I think a bashrc alias could be of use. – grooveplex Aug 19 '16 at 06:00mv ~ /dev/null
will not "move your home directory to a black hole". Rather, it will fail because you can't move a directoty to a file. Even if you tried to move a file (instead of a directory) in this way, you wouldn't move the file to a black hole, but rather overwrite your/dev/null
device (see my answer here for more details). – Malte Skoruppa Aug 19 '16 at 10:05