When using bash with or without
sudo there are many traps. For example when logged in as root between
rm -rf ~/bin
rm -rf /bin
there is just one character but this difference can make you quite unhappy.
To protect myself a little bit of such disasters I use this in my
if [ $UID -ne 0 ]; then
# ask me before deleting
alias rm='rm -i'
# do not delete / or prompt if deleting more than 3 files at a time
alias rm='rm -I --preserve-root'
With this, I at least have to confirm deleting before running into disaster. Maybe there are even more dangerous commands as rm...
What are the most dangerous bash-commands and to protect myself from day-to-day disasters?