Dangerous Linux/UNIX commands

I couldn't find a thread related to usermod command. I hope to start a thread on commands we should not perform in order to avoid jeopardizing our system.
Today, I logged in as root, and I was experimenting to see if usermod --password command has the same effect as the passwd command on root account. I just discovered that it didn't work for root. I wasn't able to log in with the password I created with the usermod command. Please avoid this if your system allow you to bypass it. Is there any other commands I should be aware of? Right now, I'm trying to prepare for the new Linux+ and become certified by the end of the summer before I return to school in the fall.
Today, I logged in as root, and I was experimenting to see if usermod --password command has the same effect as the passwd command on root account. I just discovered that it didn't work for root. I wasn't able to log in with the password I created with the usermod command. Please avoid this if your system allow you to bypass it. Is there any other commands I should be aware of? Right now, I'm trying to prepare for the new Linux+ and become certified by the end of the summer before I return to school in the fall.
Comments
I once missed the "." when typing "rm -rf ./", that was fun...
(It was actually a system I was configuring in preparation for production, so it wasn't that big of a deal, but it still made my night a couple hours longer.)
To those unfamiliar with linux/unix that command without the "." forcefully deletes all the files from every mounted file system.
You shouldn't be testing things on the root account though :P
alias rm = "rm -i"
SE Notebook
Of course, I shouldn't be testing on the root account at work. I rather learn from my mistake now than regret it later. I was able to recover the password through single-user mode.
Clever thinking, NightShade. I didn't think of that. I remember learning alias in UNIX class, but that was two years ago, and I have not yet gotten to that part in Linux Administration book I'm currently reading/studying. The book in my opinion is not so bad. It's definitely good for beginners like myself.
Agreed! However if you are the administration installing everything on the systems and setting them up....
Still your point is valid that you shouldn't rely on things because they will never be the same across machines, but alias is still something to know.
SE Notebook
For example we had some Linux build notes for other people which included rm in an command. However, the Word document changed hyphens to some other weird symbol ...
Same when it comes to email .. I don't know exactly what command that was exactly, but the commands he copied were basically going into a specific folder and delete certain files using for example
Now Word screwed up the "-" and other bits to an extend that people kept wiping "/" ...
Needless to say we made sure that we either save the document in plain text or use notepad lol - but it still is a danger when copy / paste commands from emails / websites or documents in general...
Pretty much. Word is the wrong tool for the job if you're editing scripts.
Scripting in general can be dangerous, it is easy to write a bad loop that can cause anything from high system load to massive data loss. Even though I'm experienced with scripting loops, I typically do a final check with "echo" to verify what really will be done.
One problem I've run into is not completely deleting commands that I've started and decide to abort. So for example I might type "ls a*", then change my mind and delete the "a*", then when I come back later if I'm not paying attention I'll write a new command that ends up starting with "ls" (so like "ls ls b*"). This type of mistake caused me data loss once... I ended up with a command like "rm ls *txt", and deleted some txt files. I'm trying to make it a habit to use Ctrl+c to wipe out commands instead of Ctrl+w which only deletes one part at a time. A recent bash update added a helpful feature in that Ctrl+c will also print out "^C" by default.
Another command I don't really like is the "yes" command. Sometimes I will enter some command expecting it to ask for confirmation, and if it doesn't and I'm not paying attention I'll just enter "yes" at the command prompt and lag my console while I furiously type Ctrl+C to cancel it. I think the key is to just pay attention when you're using the command prompt.
MCSA 2003, LFCS, LFCE (expired), VCP6-DCV
WGU MS IT Management: done ... double woot :cheers:
I don't like ulimit, sometimes you set something and forget about it a couple of months later. Then you realize "oh, I need more open sockets etc."