Slashdot Mirror


(Useful) Stupid Unix Tricks?

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?

4 of 2,362 comments (clear)

  1. Re:Well by FooAtWFU · · Score: 5, Interesting
    Not quite the same, but in a similar vein, cat /dev/urandom > /dev/dsp

    Sometimes a quick white-noise machine is relaxing. Heck, I used that command in combination with 'at' to act as a makeshift alarm clock when I was just moving into my first apartment and had forgotten my only other electronic device with an alarm (my cell phone) at the office.

    --
    The World Wide Web is dying. Soon, we shall have only the Internet.
  2. Re:Show attached block devices by mollymoo · · Score: 5, Interesting

    du -cks

    OK, it's not a trick or very obscure, but it is a useful set of flags and it spells the name of an animal. Which is cool, if you need to get out more. I need to get out more.

    --
    Chernobyl 'not a wildlife haven' - BBC News
  3. Re:Bah, subtlety: by Nathanbp · · Score: 5, Interesting

    :(){ :|:& };:

    :() defines a function named : with no arguments. { :|:& } is what the function does. :|: calls itself twice (with a pipe between the two), and the & at the end runs it in the background as a new process. The ; finishes off that command, then the last : runs the function, starting the fork bomb (as each run starts 2 new processes, each of which starts 2 new processes...).

  4. Re:Well by Technonotice_Dom · · Score: 5, Interesting

    Heck, I used that command in combination with 'at' to act as a makeshift alarm clock[..]

    You mentioned it only in passing, so I thought I'd draw a little more attention to it. The 'at' command is a really handy way to automate one-off tasks that many people seem to miss. The interface is neat too, understanding plain English time specifications.

    I've often seen people add a one-off task to a crontab, then try and forget to remove the entry once it's run!