(Useful) Stupid Unix Tricks? 2362
So the other day I messaged another admin from the console using the regular old 'write' command (as I've been doing for over 10 years). To my surprise he didn't know how to respond back to me (he had to call me on the phone) and had never even known you could do that. That got me thinking that there's probably lots of things like that, and likely things I've never heard of. What sorts of things do you take for granted as a natural part of Unix that other people are surprised at?
rm -rf / (Score:5, Funny)
rm -rf /
Well (Score:5, Funny)
Well.
dd if=/dev/zero of=/dev/sda1
There is this part ... (Score:5, Funny)
Uhhmmm... (Score:2, Funny)
On to the pranks! (Score:4, Funny)
I once worked with an admin that wrote a program that wrote directly to a users terminal and prompted in the same way "write" did. One notable exception is that he let you put whatever username@hostname you wanted.
I got quite a few requests from "yourmom@pronindustry.com" to chat...
Screen (Score:4, Funny)
A sys admin was recently surprised that I didn't use screen. My explaination was that all that C-x stuff reminded me too much of using Emacs.
Moderators are free to mod this Flamebait or Insightful, depending on personal bias.
rm -rf /* (Score:2, Funny)
Putting it on a list of useful *n*x tricks is useful from separating the admins who know what they are doing and those that don't.
Re:Hail to the chimp! (Score:1, Funny)
One word: (Score:5, Funny)
Showers
Re:Tab (Score:5, Funny)
Woah! Got any more?
(yes, I'm being sarcastic)
Re:rev (Score:5, Funny)
The rev command has got to be one of the most useless Unix commands I've ever come across. It's almost as if someone's first c program somehow got taken up as a part of standard Unix! Maybe in the days before sed and awk and perl it had some function in pipes that I can't grok, but nowadays other than making hints for video game websites I can't imagine what it's for.
Unhackable encryption of course.
Configuration script (Score:2, Funny)
$ configure . --ignoretroll
Configuration aborted. Installation files deleted. Uploader banned.
$
Re:X-forwarding (Score:2, Funny)
other side of the world and run X programs over forwarding.
The real amazing thing is that they stayed their waiting so long!
Re:session-sharing with screen -x (Score:2, Funny)
When I worked in a government building not too far outside of DC several of us used to enjoy telneting into our co-workers Sparc's and running X programs. My favorite was the one that made the screen look like it was melting. Also popular would be the one that caused random letters in a document to drop down a line.
Crushing a finger users terminal (Score:2, Funny)
Re:rm -rf / (Score:5, Funny)
Re:Bah, subtlety: (Score:2, Funny)
Re:Surprised that it does it correctly. (Score:1, Funny)
Maybe you should try pressing TAB a few more times in Windows...
Re:Find / Grep (Score:5, Funny)
Seen on a friend's T-Shirt (Score:4, Funny)
Re:Tab (Score:5, Funny)
Re:rm -rf / (Score:5, Funny)
rm -rf /
wtf??? (do not try this at home)
Really? What does it do? Think I'll try it and s
CARRIER LOST
Re:There is this part ... (Score:5, Funny)
I once made my friends' jaws hit the floor when I burned a cd for them - from console.
And once I had this strange feeling that something was wrong with the CD drive of a machine I was working at in the console until I realized I was opening and closing the CD tray on a machine in another room!
Re:rm -rf / (Score:5, Funny)
Re:Uhhmmm... (Score:1, Funny)
They were only bystanders... they had nothing to do with it... That's so cruel. Oh the humanity!
Re:rm -rf / (Score:5, Funny)
OMG OMG What did I do. What did I do. I am so fired. I am so EFFIN fired.
Re:rm -rf / (Score:5, Funny)
A real time saver! (Score:2, Funny)
Summary: Reorganizes* the data on your disks for maximum read performance.
* Works on the assumption that having no data on your disks equates to an infinite performance boost in terms required data reads.
This is a good one: (Score:1, Funny)
$ man woman
Re:cd - (Score:3, Funny)
You just made pseudoterminals 4% more useful to me.
Re:rm -rf / (Score:5, Funny)
cat /dev/urandom > /dev/dsp
Re:grep -R (Score:4, Funny)
BTW: How does one ork a cow?
Very, VERY, carefully.
Re:Bah, subtlety: (Score:5, Funny)
@$**& well we know it works in cygwin too.
My personal fave (Score:5, Funny)
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc
Re:rm -rf / (Score:5, Funny)
sleep 8h; cat /dev/urandom > /dev/dsp
That's my alarm clock.
Re:Listing directory contents without the ls comma (Score:5, Funny)
Re:rm -rf / (Score:3, Funny)
rm -rf /*
it stands for: Read Mail Really Fast
You can read mail faster, if you are root
Re:I never knew that command (Score:5, Funny)
[...] a gift from the dieties.
Are they the ultra-slim super humans I keep hearing about? Or am I confusing them with deadly cocktails??
Re:rm -rf / (Score:5, Funny)
OMG OMG What did I do. What did I do. I am so fired. I am so EFFIN fired.
Ha, I didn't get fired when I did it. It was about ten years ago now, I had a linux dualboot setup on a test PC and didn't need the linux install any more.
I thought, "I've always wanted to try rm -r /" so I did. About four seconds later it dawned, with an "oh shit" that I still had the dos/windows 3.11 partition still mounted read write.
Fortunately, I didn't permanently lose anything between good backups and Norton Disk Doctor.
Re:If he liked write (Score:3, Funny)
Back in college where I met my first Unix systems we used finger to show if someone was online and then used talk (or was it ytalk?) to chat .. very useful for punctuating the intense concentration of some computer lab sessions.
Re:How about a new GUI apt get trick? (Score:3, Funny)
Also, Yum is good for reducing stress by conveniently giving you ten minutes to an hour of relaxation time while it completes each operation.
Re:rm -rf / (Score:3, Funny)
Re:rm -rf / (Score:5, Funny)
I keep getting Windows cannot find 'rm' when I type that in. Am I doing it wrong?
what the hell. I had karma to burn.
Crashed My Laptop! (Score:5, Funny)
My system booted up fine, so of course the first thing I wanted to do was make it happen again.
Thirty seconds after the output finished and I'm looking at the garbled POST screen again. My laptop finished booting, I ran the command a third time before coming to tell Slashdot and
Re:Tab (Score:5, Funny)
Apparently in Unix you can connect to another computer - get this - *without having to be at the screen* to see it! I think the software was developer by a company called Shell or something. You use 'shhhh' to use it, which I think tells the computer to basically quieten down its TCP communications so it can get ready for the connection to the other machine. I'm probably not doing it justice but you have to see for yourself.
It's not as good as Windows though because you still have to use typing to do things, and then it's only very boring things like deleting files. :-( I haven't found Solitare or Pinball yet. Hopefully Shell will invent a remote desktop program soon though so we can replace Remote Desktop!
Re:Tab (Score:5, Funny)
Seriously, I was giving a presentation at a LUG meeting a few years ago, and during a break, some guys came up to me and said "We know you can't type that fast. How do you do that?"
Re:There is this part ... (Score:5, Funny)
True story.
A friend and I help admin the computers in my (former) high school. Due to security the doors were locked during off hours, and I'm not a frequent helper so I don't have the keys, but my friend did.
There was once when I was basically stranded in the computer lab, and my friend was in the server room (where the cell phone signals didn't reach). I don't know what he was doing at that time, but "walls" (on the linux machines) and "net sends" (to the Windows servers) didn't seem to work, so I ran a script to open and close the CD tray hoping to catch his attention.
I got a message asking "wtf are you doing?" a few minutes later :)
Re:Seen on a friend's T-Shirt (Score:4, Funny)
yeah, but first you will need to
find /bin/laden
I love controlling the power and security... (Score:3, Funny)
Re:Show attached block devices (Score:5, Funny)
Oh my ghod. This is considered informative? Who let all the PFYs in?
Re:session-sharing with screen -x (Score:5, Funny)
In a similar vein, back in the days of floppies you could have endless fun ejecting other people's disks from Sun workstations. They put it in, you eject it. They put it in, you eject it. Repeat till you get bored or it looks like they're about to do a 'who'.
Re:Sounds.. (Score:3, Funny)
That is exactly why you should never:
a) give friends accounts on a Linux box in your dorm room
b) keep your speakers turned on
c) keep the machine running while you sleep
I speak from experience
Re:rm -rf / (Score:5, Funny)
Hello?
Re:This one always surprises people for some reaso (Score:3, Funny)
Re:Show attached block devices (Score:5, Funny)
On the contrary, shorter IS something to be proud of.
Cool! Thanks! I'll tell my boyfriend that next time!
Re:Show attached block devices (Score:3, Funny)
Do you watch the Colbert Report? Remember the whole "Bridge in Hungary" vote thing? I was one of the people driving that ;) I wrote an elaborate script that auto-changed proxies whenever they blocked an IP or whenever it went down, switched secondary domains whenever they blocked emails from that domain, and so forth, all the while making up registrant names and email addresses, confirming them, and then voting. Much fun was to be had ;)
Re:rm -rf / (Score:5, Funny)
[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live"
Re:Tab (Score:1, Funny)
Autocompletion reads your mind! In fact this message was typed entirely by pressing repeatedly.
Re:Bah, subtlety: (Score:3, Funny)
Re:Show attached block devices (Score:2, Funny)
history - use it with grep if you forgot what you did
This might come in handy the next time I've been boozing again...
Re:rm -rf / (Score:1, Funny)
Re:Show attached block devices (Score:4, Funny)
.py or it didn't happen.
Re:rm -rf / (Score:5, Funny)
Thank you.
There's two kinds of real UNIX Admins.
1. Those who have yelled "Oh Shit!"
2. Those who will.
Re:rm -f /lib/libc* (Score:5, Funny)
You want subtle?
ln -f /bin/rm /usr/bin/diff
Re:rm -rf / (Score:3, Funny)
my unix koan is:
puercopop@localhost ~ $ which which
which: no which in (/usr/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2:/usr/qt/3/bin:/usr/games/bin)
Re:rm -rf / (Score:2, Funny)
Quick, somebody write a patch to gcc so you can 'hear' the name of each function call!
Re:Show attached block devices (Score:4, Funny)
It's shorter you want eh? How about...
Aaaand that's my cue to go find something to do away from the computer.
hu..?? (Score:2, Funny)
Re:Show attached block devices (Score:3, Funny)
Hey, if you want to believe that I stay awake 24/7 changing my sig every 15 minutes every day, that's your call.
Umm... Your script can't be working too well at the moment, or your random number generator is broken.
You have three posts this morning, all with the same sig:
Thursday November 06, @08:50AM
Thursday November 06, @10:04AM
Thursday November 06, @10:41AM
Re:There is this part ... (Score:5, Funny)
Years ago in college we had a few Sun 3 workstations, and all of us CS types had logins on them of course. I also worked for the university computing department as did one of my fellow CS students. Often I'd be working on the Sun 3 when he'd log in and run his "xeyes from hell script", which would essentially open a bunch of xeyes with random geometries.
Usually, when he was doing this he was sitting in another office working on a DOS machine running NCSA Telnet, which had the awesome feature that it would run an FTP server when you were using telnet.
So, I would go to another machine, figure out his IP address using "w", and ftp to his desktop. Then I'd type the killer: "cd a:".
With that, it would use the old BIOS call, which in the absence of a floppy would literally lock up the machine and prompt you to stick a disk in.
It gets better (or, worse if you're Colin). After he'd scrape up a floppy and stick it in, I would get the prompt back letting me know he'd found one. No problem: "cd b:".
There was no second floppy on that particular machine, so the BIOS would emulate two floppies and keep track of which was which. So he had to run and grab another to make the machine usable again. At that point, I could lock the machine up at will simply by cd'ing to the other floppy. And he would find me, and use "write" to ask for a truce.
Funny thing is, it was really easy to turn off the ftp server. I guess I can let that cat out of the bag now.
Re:I never knew that command (Score:5, Funny)
Pretty much anything in here: http://www.openbsd.org/cgi-bin/man.cgi [openbsd.org]
Re:rm -rf / (Score:1, Funny)
I keep getting "rm: not found" when I type it in.
Strangely, the first time I tried it, it just sat there for ages, and then displayed a "#" prompt.
Re:rm -rf / (Score:4, Funny)
Re:There is this part ... (Score:3, Funny)
This reminds me of the games I used to play with the wife. She is a windows gamer and always in the computer room. So I ssh'd into my *nix system and first ejected and retracted the cdrom a few times. Then I printed a page that said something to the effect of me being the ghost of someone who had died in the apartment and that I needed to communicate with the living.
Had a nice effect, I had a big monster laser printer and there is no way you could fail to hear it warm up. Freaked her out good and proper.
Re:rm -rf / (Score:3, Funny)
A damn space more! Fortunately I realized that it was taking too much time to be the local var so I stopped before going into /var/mail.
Geek meets girl... (Score:2, Funny)
who;uname;talk;date;wine;cd ~;talk;touch;talk;touch;more;finger;mount;fsck;yes;more;yes;yes;umount;make clean
Oldies but goodies (Score:1, Funny)
for example:
% If I had a ( for every $ the Congress spent, what would I have?
Too many ('s.
http://www.csd.uwo.ca/~magi/personal/humour/Computer_Audience/Funny%20UNIX%20Shell%20Commands.html
10! (Score:3, Funny)
> There's two kinds of real UNIX Admins.
Actually, there are 10 kinds of UNIX admins...
Re:rm -rf / (Score:5, Funny)
/dev/random to the dsp device ? I prefer to the midi device, then it sounds like someone throwing a drumkit and grand piano down the stairs at the same time.
Re:rm -rf / (Score:4, Funny)
You have a definition for a "short lunch"?
What the hell kind of sysadmin ARE you?? You certainly don't wear the same brand of suspenders us REAL techies do.
Re:rm -rf / (Score:5, Funny)
e.g.
A: "Type rm -rf
B: "OK"
A: "Next..."
B: "Wait it's not done yet"
A: "?"
A: "!"
Seems like people should be more careful about product directory names
Don't call your directories stuff like "star" or "slashdot" if you ever might need to get people to remove them over the phone.
Best Dilbert (Score:5, Funny)
Dilbert: I think you mean Unix. Yes we have a lot of Unix machines here.
PHB: Oh... [pauses and thinks]... If the company nurse comes by, tell her I said, "never mind."
Re:10! (Score:2, Funny)
Actually, there's 3 kinds of UNIX admins...
- those who can count
- and those who can't
Re:session-sharing with screen -x (Score:1, Funny)
xroach. I set it on a colleague's login whom I'd warned not to use 'xhost +', and instead to use 'ssh -X' for getting X sessions to work correctly when logged in elsewhere. The shriek when she came back from lunch and thought there were real roaches on the screen was pretty prize, even though my boss yelled at me about it.
Fortunately, everyone laughed when I showed them how to smash the roaches, and they tended to play it when bored. That helped ease my reprimand quite a lot when the woman who screamed got really into it.
Re:rm -rf / (Score:3, Funny)
Wow. I had never even thought of that.
Man.... I do sometimes question some decisions made with unix directory operations. Like some of the legal characters in directorynames, for instance. I mean, escaping spaces is all fine and dandy, but what about "/usr/bin/?*&!" Perfectly legal unix filename, but an unholy bitch to deal with. Not that anyone would ever do that with non-malicious motives, but still...
Re:rm -f /lib/libc* (Score:3, Funny)
Re:rm -rf / (Score:4, Funny)
Re:There is this part ... (Score:3, Funny)
meh, good OS but lacks a decent editor.
Re:Crashed My Laptop! (Score:3, Funny)
The geek looked out of the window and said "Look! Scottish sheep are black!" then looked out of the window twice more, and confirming it was still black each time, posted this fact to /.
(I would have done the same thing)
Wake up with festival.. (Score:3, Funny)
Another alarm clock of sorts..
for i in `seq 1 10`; do echo wake up | festival --tts ; done;
Good for scaring the cat too.
Re:Tab (Score:2, Funny)
or how often your the sysadmin for a bunch of scientists who ask you a question.
"so i go into this directory"
cd /into/a/really/long/directory/without/using/tab/completion
"and run this command" /why/don't/you/just/add/this/to/your/path/command
and they type REALLY slowly, sometimes i'm sitting there for a good ten minutes before i just get angry
Re:rm -rf / (Score:2, Funny)
Re:rm -rf / (Score:5, Funny)
$ touch woman
But I always get this back:
$ touch: woman: Permission denied
:(
Re:There is this part ... (Score:5, Funny)
True story:
I was in a class learning how to install and run a network management program (this was mid-1990s), and the class had a set of IRIX systems to work from. There were six systems to work on, so some of the students had to pair-up.
The class was pretty-much done, and we were waiting to be dismissed.
Suddenly, I get a message on the console of my system stating that the system would reboot in five minutes. (This was the system default.) I went in, found and killed the shutdown process, then checked the logs to see who kicked it off. It was the two clowns in front of me. I went into their system (there was no real security here, if you haven't figured that out. The systems weren't on the Internet, so it wasn't a big deal) and set the system to init state 0 (this reboots the system immediately, for you guys that are oblivious to init states).
They looked at each other, they looked at me (I was just sitting there, looking at their reaction), and they looked at each other again. One said, "See? I TOLD you we shouldn't have f*d with him!"
Heh. :)
Re:rm -rf / (Score:5, Funny)
puercopop@localhost ~ $ which which
which: no which in (/usr/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2:/usr/qt/3/bin:/usr/games/bin)
Burn her anyway!
Re:rm -rf / (Score:3, Funny)
Recently a co-worker did the oh shit thing. What is the normal unix flag for increasing verbosity of feedback from a command? Now go man pkill and use your imagination on what happened. :-)
Re:Time warp (Score:2, Funny)
cal 9 1752
WHAT DO WE WANT? "Eleven days back!"
WHEN DO WE WANT THEM? "...!!"
Re:rm -rf / (Score:3, Funny)
1/42?
Re:rm -rf / (Score:2, Funny)
root@linux:/# cd lib /lib
root@linux:/lib# ls lib
[...hacker-injected garbage...]
root@linux:/lib# rm -rf .
BOSS: "Boy, this sure is taking a long time."
root@linux:/lib# ERROR: rm: cannot load libc.so.6
SYSAD: "But I told you to rename slash-lib-slash-lib to slash-lib-slash-garbage, just in case. Did you..."
sysadmin@linux:# ls /lib
ls: cannot load libc.so.6
SYSAD: [silence, waiting for BOSS to understand what he did, and why he shouldn't have root]
BOSS: "Yeah, I got this error about 'libc.so.6'"
SYSAD: "I know. You deleted slash-lib, because you didn't do the rename like I told you to."
BOSS: "Oh... damn..." (frantic clicking ensues, trying to cancel job)
SYSAD: "I'll meet you at the office. Bring beer: it's going to be a long night."
Re:rm -rf / (Score:5, Funny)
Mediocre minds think alike. Great minds are unique.
My thoughts exactly.
Re:rm -rf / (Score:4, Funny)
Try doing it in your own home for better results..
Re:rm -rf / (Score:3, Funny)
I prefer this one:
$ touch woman
But I always get this back:
$ touch: woman: Permission denied
Try doing it in your own home for better results..
Depends. He might still live with his mother.
Re:rm -rf / (Score:1, Funny)
Sniff a republican, smell an oppressor
Re:rm -rf / (Score:3, Funny)
Unless he meant that there are only about thirteen hundred of them out there. It sure would explain why people ask me to fix their computers so darn often.
Re:rm -rf / (Score:2, Funny)
kill woman
-bash: kill: woman: arguments must be process or job IDs
Even in Linux you can't bash or kill woman - it requires an argument and I'm sure the job ID is really a reference to your paycheck.
Re:rm -rf / (Score:3, Funny)
Blah.
$cd somefolder
only junk
$rm -Rf *
somejunkfile: permission denied.
$su -
Password:
#rm -Rf *
It was Solaris, ~root was /
Comment removed (Score:3, Funny)