Most deadly commands on Unix/Linux !!


 
Thread Tools Search this Thread
The Lounge What is on Your Mind? Most deadly commands on Unix/Linux !!
# 15  
Old 07-22-2009
A few years ago I had a very functional linux from scratch machine built. I had Xfce up and running as well as all of my applications. I was installing the proprietary AIM client and went to clean up after the installation when I did this:

Code:
# rm -rf *
# pwd
/usr/lib

# 16  
Old 07-22-2009
The chmod one is good - the chown one is also good (for different reasons)

I remember a few years ago (I wasn't a sysadmin) I noticed the passwd file had 666 permissions (how appropriate). Only my honesty prevented me changing my uid to 0 (honest).

Everyone's done the rm -rf one, surely!
(it was a long time ago, but went something like this (fortunately at home)..)
Code:
cd /u01/data/backup
ls -l
X=$PWD
cd /u02/data
ls -l
(looks good)
rm -rf $x/*

I don't ever remember doing that twice! As root, if I did it now, I'd just clear my desk and leave my badge at the front desk on the way out!
# 17  
Old 07-22-2009
A few years ago I made a chown -R mistake. I found out that the hard way that chown -R user:group .* (the solaris version anyway) will see .. as part of the recursion and change ownership of all files and directories (and everything in them) one level above the directory you are in. I did this in my home directory on the NFS server that shared them out. I ended up owning everyones files...

Another mistake I have made is getting distracted and doing shutdown -i6 -y -g0 on a server instead of my workstation. I consider myself lucky to have never screwed up a production machine bad enough to get me in trouble. My advice to anyone reading this trying to get their foot in the door and get a UNIX job is to download a free UNIX and make your mistakes at home. I also recommend aliasing commands like rm -rf to rm -rif. Especially for root.
# 18  
Old 07-22-2009
On Linux it's pretty simple to do killall commandname instead of killing things by pid all the time, but it can be a dangerous habit to get into. This command exists on Solaris and, I think, several other flavors, but has a completely different and absolutely literal meaning. It needs no arguments. Smilie

---------- Post updated at 03:06 PM ---------- Previous update was at 02:57 PM ----------

Quote:
Originally Posted by ilikecows
A few years ago I made a chown -R mistake. I found out that the hard way that chown -R user:group .* (the solaris version anyway) will see .. as part of the recursion and change ownership of all files and directories (and everything in them) one level above the directory you are in. I did this in my home directory on the NFS server that shared them out. I ended up owning everyones files...
It's smart enough to reject "." and so not loop forever through the same directory, but nobody thought to reject "..". How odd. Smilie
# 19  
Old 07-22-2009
which you will never get the files after this... will you???
Code:
mv /home/yourhomedirectory/* /dev/null

# 20  
Old 07-22-2009
/dev/null doesn't work that way. You cannot move files into something that's not a directory. And if ~/* turns out to be one file, it will still complain that you cannot remove /dev/null to replace it unless you're root.

That said, replacing /dev/null with an ordinary file might mess up any number of things...
# 21  
Old 07-23-2009
I've just decided. The most deadly command is vi!

I made some changes to inittab on a "new" Solaris Netra and the server wouldn't boot (obviously I typed something wrong!). I spent the last I'm-too-embarrased-to-say-how-many hours fixing it!
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

What is the best way to remember UNIX / Linux Commands?

Hi all, I'm new to UNIX world and new to this forum. As I observed there are lot of commands that needs to be remembered in UNIX programming. I'm into DevOps and can anyone please tell me what are all the important commands that are useful for DevOps Engineer. NOTE: Please correct me if my... (3 Replies)
Discussion started by: maxlink
3 Replies

2. UNIX for Dummies Questions & Answers

Unix and Linux Commands

Hi All I have found that few basic commands in unix have the same syntax in linux as well. I need those commands which differ on Linux platform, with some more advanced options.. For example... awk, sed, tr ... and some more commands with advanced options. I am trying to search on the linux... (1 Reply)
Discussion started by: vee_789
1 Replies

3. Shell Programming and Scripting

Compare two file (please help me it's deadly urgent)

I have many files with info about soft, installed on remote machines. I need to compare this file with template (soft than must be installed) and output file must content info about software that's not installed. template.txt software_name1 software_name2 software_name3.1 ... (14 Replies)
Discussion started by: cintlt
14 Replies

4. UNIX for Dummies Questions & Answers

Name 10 commands every Linux and Unix admin should know

I'm working on further developing my Unix skills and I'm just curious what some of the experienced admins out there would consider to be 10 essential commands every admin should know. (12 Replies)
Discussion started by: Arkitech
12 Replies

5. Shell Programming and Scripting

Linux Commands

This is my first time using this forum. My question is simple. I need a book that has the commands code for Linux, if there is such a book, of course. Thank you (1 Reply)
Discussion started by: ropapi
1 Replies

6. News, Links, Events and Announcements

All Linux and Unix commands Links

http://www.computerhope.com/unix.htm http://www.linuxdevcenter.com/linux/cmd/ (0 Replies)
Discussion started by: devotedsinner
0 Replies

7. UNIX for Dummies Questions & Answers

unix commands in linux-red hat

hi, can i have a unix like environment where i can do things like chmod, shell scripts and etc.. in redhat instead of the GUI that redhat ofters? (4 Replies)
Discussion started by: yls177
4 Replies

8. UNIX for Dummies Questions & Answers

Maingrame to UNIX sending UNIX commands

I want to know if there is a way to send unix commands thru FTP from a mainframe to kick off Autosys Jobs. I just need to send a command from the mainframe to UNIX and have UNIX execute that command. (2 Replies)
Discussion started by: skammer
2 Replies
Login or Register to Ask a Question