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?

13 of 2,362 comments (clear)

  1. session-sharing with screen -x by FooAtWFU · · Score: 5, Insightful
    (used in my company for doing the agile/extreme "pair programming" think with a remote devloper, among other things).

    screen is awesome.

    --
    The World Wide Web is dying. Soon, we shall have only the Internet.
  2. grep and awk by yakmans_dad · · Score: 4, Insightful

    So much easier for me to use than perl. I presume the modern unix user prefers perl.

  3. I never knew that command by PingXao · · Score: 5, Insightful

    And I've been administering Linux systems for awhile now. Step back for a moment and you'll find that "man pages" and "info" are actually a pretty awful way to distribute documentation. As a supplement they'd be fine, but as the main source of information on how to use many commands... not so much.

    1. Re:I never knew that command by PhilipPeake · · Score: 5, Insightful

      This is only true because people write such terrible and incomplete manual pages.

      The original Bell Labs man pages completely described the system from the point of view of an administrator or user. The only better documentation was the source.

      The current blight of wimpy, inaccurate and incomplete man pages seems to originate from the GNU developers who insist on using the terrible "info" crap, writing huge volumes of text with no real content, and the tradition is continued by Linux developers who generally provide little or no man page documentation -- presumably in the hope that users of their software will be tempted to ask questions on various mailing lists where they can be ritually disemboweled for displaying such a lack of understanding and disturbing the peace of the cognoscenti who have much more important things to do than answer questions of mere users of their software.

  4. Re:X-forwarding by BigJClark · · Score: 5, Insightful


    ... or even funnier, is how long (as in decades) we've been able to do that.

    --

    Hi, I Boris. Hear fix bear, yes?
  5. Bah, subtlety: by FooAtWFU · · Score: 5, Insightful

    :(){ :|:& };:

    --
    The World Wide Web is dying. Soon, we shall have only the Internet.
  6. Re:rm -rf / by acidreverb · · Score: 5, Insightful

    Mediocre minds think alike. Great minds are unique.

  7. Re:Tab by jcam2 · · Score: 4, Insightful

    You'd be surprised how often I have seen experienced programmers manually type out long commands or directory paths, instead of using tab completion. Sometimes I have to restrain myself from ripping the keyboard from their hands and using tab to enter the path myself in a 10th of the time.

  8. Re:rm -rf / by Omega996 · · Score: 5, Insightful

    sudo is for ubuntu wannabes - real UNIX admins don't sudo - they su - .

  9. Re:rm -rf / by j79zlr · · Score: 4, Insightful

    Fortunately, I didn't permanently lose anything between good backups and Norton Disk Doctor.

    Yes, you do need good backups whenever you are running Norton products. Good idea.

    --
    I'm not not licking toads.
  10. Re:rm -rf / by Teilo · · Score: 4, Insightful

    No. People who run as root all the time are either n00bs or morons.

    N00bs if they have never spoken the words, "Oh sh*t!" after running a command;

    Morons if they have.

    --
    Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
  11. Re:rm -rf / by Omega996 · · Score: 5, Insightful

    if you haven't said "oh shit" while doing something as root, you haven't done UNIX administration in a busy production environment.

  12. Re:Useful tricks. by cowens · · Score: 4, Insightful

    Next trick, back ticks. `` Back ticks substitute the output of a command within a command.
    Ex. Name a file after the date. echo "hi" > `date +%Y%M%d`.txt

    Don't use backticks unless you are stuck with bourne shell. Use $() instead:

    echo hi > $(date +%Y%M%d).txt

    They have two benefits over backticks: you can nest them and they are easier to see.