Slashdot Mirror


Top 10 Items in the Linux Admin Toolkit

Joe Barr writes "Joe 'Zonker' Brockmeier has listed his favorite top ten tools for Linux system administration in a story on Linux.com, one of Slashdot's sister sites." From the site: " Since I spend a lot of my time working with text files, either when I'm writing and editing or when I'm mucking with configuration files and shell scripts, I've become very attached to my editor of choice -- Vim. Over the years, I've tried a lot of other editors, but none of them has been sufficient to coax me away from Vim. Part of the reason for that is the fact that I no longer have to think about using Vi-style keybindings, and adjusting to anything else would seriously hinder my productivity."

86 of 357 comments (clear)

  1. Most important item by Anonymous Coward · · Score: 5, Funny

    Condoms! With all the groupies chasing Linux system admins, you can never have too many condoms!

  2. strace by epiphani · · Score: 2, Informative

    by far the most useful tool in troubleshooting.

    --
    .
    1. Re:strace by lky · · Score: 3, Informative

      Dont forget these, any one will provide the needed/wanted tools for recovery.

      Forensic and Incident Response Environment: http://fire.dmzs.com/
      Linux Bootable Business Card: http://www.lnx-bbc.org/
      Ultimate Boot CD: http://ubcd.sourceforge.net/
      Knoppix Security Tools Distribution: http://www.knoppix-std.org/
      SystemRescueCd: ahref=http://www.sysresccd.org/rel=url2html-26348h ttp://www.sysresccd.org/>

  3. Re:Vim? Emacs foreva! by Rosco+P.+Coltrane · · Score: 2, Informative

    You're right, with this, Emacs rocks.

    --
    "A door is what a dog is perpetually on the wrong side of" - Ogden Nash
  4. Re:Vim? Emacs foreva! by MORTAR_COMBAT! · · Score: 5, Funny

    the article said "toolkit" not "tool shed, tool warehouse, and tool factory on wheels".

    --
    MORTAR COMBAT!
  5. FLAME ON! Or not.... by Bonker · · Score: 5, Insightful

    Yes, let's dig one of the oldest flamewars back up in the summary rather than discuss some of the article's other excellent information.

    TFA mentions WGet, one of the most wonderful, most needed applications that most users and admins ON EVERY PLATFORM don't know they need. Why not focus on this rather than ressurect the text editor wars?

    --
    The next Slashdot story will be ready soon, but subscribers can beat the rush and slashdot the links early!
    1. Re:FLAME ON! Or not.... by Bogtha · · Score: 4, Insightful

      Why not focus on this rather than ressurect the text editor wars?

      Big flamewar == more pageviews. More pageviews = more ad impressions. More ad impressions == higher profits.

      Slashdot editors post "provoking" (i.e. flamebait/troll) summaries/articles so frequently that you can essentially rule out stupidity and go straight to malice.

      --
      Bogtha Bogtha Bogtha
    2. Re:FLAME ON! Or not.... by arevos · · Score: 2, Interesting

      Does anyone seriously have flamewars over Vi vs. Emacs anymore?

  6. Clasis usability by oliverthered · · Score: 2, Insightful

    adjusting to anything else would seriously hinder my productivity, for a couple of weeks after which it may improve significantly.

    I like vim for command line and something like textpad for GUI text editing. I've never tried Emacs, but then again I don't do a huge amount of text editing.

    --
    thank God the internet isn't a human right.
    1. Re:Clasis usability by Macka · · Score: 3, Informative


      I like vim for command line.....

      You can't do a whole lot of typing on the command line then either. I've never bothered to learn to use the Emacs editor (tried about 15 years ago and hated it) so I always use the vi editor ... but when it comes to command line editing, "emacs mode" whoops "vi mode" totally. Being able to use the arrow keys to scroll back commands or navigate the command line, along with ^a (beginning of line) ^e (end of line) ^r (to search for strings in your command history) ... "esc." (that's "dot" not a full stop, to recall the last field in the previous command string, etc, etc, etc....

      The only time I've had to use vi mode for command line editing is on HP-UX, where the lack of a modern shell by default and crap emacs mode support have forced me into it. The usability difference is horribly noticeable.

  7. Go flameware! Go Zonk! Go /. by conJunk · · Score: 2, Funny

    nothing quite like a vi/emacs flame fight to cap off the afternoon, eh? thanks y'all!

  8. Re:Vim? Emacs foreva! by Anonymous Coward · · Score: 5, Funny

    The only 3 commands any Emacs user needs to know:

    Ctrl-x
    Ctrl-c
    vi

  9. Re:My List by Rosco+P.+Coltrane · · Score: 3, Funny

    Don't forget:

    - 1 bag of Cheerios
    - 3 lettuces
    - 1 lbs of carrots
    - Detergent
    - 6 Dr. Pepper bottles
    - 1 box of tampons

    otherwise don't bother to come home.

    -- Your wife Linda

    --
    "A door is what a dog is perpetually on the wrong side of" - Ogden Nash
  10. Mine by hackstraw · · Score: 5, Interesting
    In alphabetical order:
    • [rs]sh - enables me to go places w/o passwords, copy files, and remotely execute commands. I can't live without it
    • cron - does my work for me while I sleep, and mails me the results in the morning
    • grep - the filter of filters. Keeps down the signal to noise ratio
    • less - the pager of pagers. With a proper lessopen/pipe, you can do what no man has done before. You can go backwards in files, although I guess some 'more's can do this now. Less always can. It also highlights text searches so I don't have to search for what I just searched for.
    • man - that's where they hide the documentation. Shame on those that only provide info, text, or worst, html documentation (or none)
    • perl - anything that any other command cannot do, or cannot do well enough, perl can with some coaching.
    • rsync - although its binary diff algorithm is not very good, rsync is close to heavenly, especially
    • when teamed with [rs]sh and cron
    • telnet - no, I never telnet to login to a machine, but I do it to test if a port is open, what's listening there, etc. very handy.
    • vim - good editor, I can live with vi, but that makes me a little grumpy. I simply do not know or care to learn emacs. Its just a text editor.
    • zsh - excellent shell. Very user friendly, consistent error messages, powerful. It can do anything any other shell can do and more. I understan
      d that bash has made some progress over the years, but zsh is my friend.
    • /dev/null - where I put all of my important stuff. So should you!

    • Honorable mention - /bin/sh Only because it is always there by definition on UNIX systems, and a good shell programming language. tcsh, csh, and zsh are not as good as /bin/sh, and its always available, but a little boring to write about.
    1. Re:Mine by Stephen+Williams · · Score: 4, Informative

      Shame on those that only provide info, text, or worst, html documentation (or none)

      For reading HTML docs over ssh or on an X11-less machine, might I recommend w3m? It's a very comfortable text-mode web browser. Unlike Lynx, it renders tables nicely, and even makes a brave attempt at frames.

      -Stephen

    2. Re:Mine by illustir · · Score: 2, Informative

      I agree with most of your stuff and you're probably better at *NIX than I am but I might suggest replacing telnet with nc which does both connecting and listening.

      --
      -- Alper
    3. Re:Mine by frodo+from+middle+ea · · Score: 2, Interesting
      use netcat instead of telnet to test port connectivity. you can even use it in a shell script.

      My additions

      • find and xargs
      • dmesg
      • uname -a
      • ps --forest
      • awk :- for when perl is not available
      • ssh/scp
      • netcat
      • mc
      • elinks :- better alternative to lynx
      --
      for the last time people, I am "frodo from middle eaRTH", not "middle eaST".
    4. Re:Mine by BrookHarty · · Score: 3, Interesting

      Everyone I know switched to SSH and dumped RSH. Keyfiles are your friend.

      ssh/scp
      snoop
      cat (Sometimes easier to paste a file than scp one)
      tail (-100f, I dont care if you are changing the command!)
      ksh (solaris standard)
      du (I always catalog an entire system, quicker than find, and im impatient)
      But grep, perl and less, vi are always on the list.
      and bzip/gzip for log files.
      telnet for testing ports.
      Cron is more server process, I wouldnt coun't it as a command.

      But for home use, wget, screen, links, du. Wget under screen for files.

    5. Re:Mine by mindriot · · Score: 5, Informative

      While rsync is very nice for syncing files, I've found another, somewhat related tool much nicer for my purposes. I have a desktop and a laptop computer, and to a great extent I work on the same files on both. Syncing my home directories could be done using rsync to some degree, but it's rather painful if you have modified files on both sides.

      This is where unison comes in handy. It keeps two directories synchronized nicely, adjusting changes in both directions automatically and querying the user in case of collisions. One of my favorite tools, and I'm sure I'm far from being the only one with a need for something like it.

    6. Re:Mine by hackstraw · · Score: 2, Interesting

      Everyone I know switched to SSH and dumped RSH. Keyfiles are your friend.

      I use rsh/rcp on private networks. Less overhead, no need for keys, and it reminds me of the good old days when the internet was a friendly place :)

      I require ssh to access a machine from the outside world, but once your in, we are all friends again.

      Yeah, du is arguably top 10 or 20. gzip/bzip/tar definitely top 20, but boring.

      I cannot believe that I forgot truss/strace/ktrace.

      That family of commands are top 10 to knock somebody off. Don't know whats going on? These guys will tell you.

      Cron is more server process, I wouldnt coun't it as a command.

      True.

      I also guess sed is top 10 or 20 as well. Top 10 is rough for UNIX because there are so many small utilities that do killer stuff.

    7. Re:Mine by Anonymous Coward · · Score: 2, Informative

      rsync - although its binary diff algorithm is not very good, rsync is close to heavenly

      Except it's a piece of junk! We used to use it to maintain a set of files between two servers. As long as the number of files was trivial, it worked. When copying 22M files with gigabit ethernet between two Sun servers each with 8 gigabytes of RAM, it took almost a week to copy over the single file that had changed. rsync took almost a gigabyte of RAM and almost a week of time just to copy one file! Now we just run a simple script that runs find then scp to copy complete files that changed. It take about two hours. The simple shell script is over 75 times faster than rsync.

      These problems with rsync have been known for years. Do a search on deja.com to see all of the complaints.

    8. Re:Mine by FyRE666 · · Score: 4, Funny

      egrep is more useful than grep
      netcat (nc) is more better than telnet

      I don't wish to be picky, but it's
      "netcat (nc) is more betterer than telnet"

      Please prof reed yor articals!

    9. Re:Mine by i.r.id10t · · Score: 3, Informative

      Better thank lynx is links. Handles tables, frames, etc. no problem. Also, it can be compiled with various options to make it a graphical browser too, which is handy for X exported over SSH type things.

      --
      Don't blame me, I voted for Kodos
    10. Re:Mine by portscan · · Score: 2, Insightful

      if you are a sysadmin, then you are administering the system. perl would always be available.

      that said, awk rocks.

    11. Re:Mine by cwry · · Score: 2, Informative
      The comment on nasty, resource-hogging pipes is interesting, because on my system, using grep instead of -name is consistently faster than find:
      $ for ((i=0;i<5;i++)); do time find ~ 2>&1 | grep foo > /dev/null; done 2>&1 | grep real
      real 0m0.486s
      real 0m0.482s
      real 0m0.486s
      real 0m0.481s
      real 0m0.484s
      $ for ((i=0;i<5;i++)); do time find ~ -name foo 2>&1 > /dev/null; done 2>&1 | grep real
      real 0m0.575s
      real 0m0.581s
      real 0m0.577s
      real 0m0.576s
      real 0m0.579s
      Sure, it's not a huge difference, but the fact that grep is ~16% faster doesn't make me think twice about using the more generic | grep foo. The speed difference is even larger when you introduce wildcards. For example -name '*.foo' versus grep '.*foo$'
    12. Re:Mine by gregoryl · · Score: 2, Interesting

      "You can go backwards in files, although I guess some 'more's can do this now. Less always can. "

      'more' on commercial UNIXes has been able to do that for ages (though in Solaris and MP-RAS you have to use /usr/xpg4/bin/more instead). At least 5 years (memory doesn't go back further than that.) It's only linux that's dragged behind on this. Personally it infuriates me - linux is one of 5 UNIX[-like] OSes that I use daily, and the only one that thinks to be different in this. I've been typing 'more' in UNIX now for 15 years, and still do on everything except for linux. Why rename it? (Yes I know I could just rm and symlink or do an alias - I have done - it's the principle.) I can emerge several different vi derivatives and they all answer to 'vi'.
      It's not the only thing too that's annoyingly different in linux:
      * most distros complain that nslookup 'depreciated' and should use dig - nslookup is still the standard on other UNIXes.
      * head and tail complain that should be using the -n argument instead of the normal "head -#" like UNIX has had for decades. Why???
      * shells wont properly parse:
      echo "one two three" | while read blah ; do echo $blah ; done
      which it will on all other UNIXes.

      Seriously, why be different? I used to be an eager linux touter like the other slashdotters, and when I write scripts and work instructions to be used on all the commercial UNIXes I find the odd silly difference - but when we got a couple of linux systems the other day my initial joy when out the window.

      I currently maintain 300 UNIX boxes in a major corporation, of which linux would only be suited for a couple of the roles (more of hardware limits and software compatibility than politics) and it's these silly little things that cause linux to not subtly slip in to the corporate world.

    13. Re:Mine by tzot · · Score: 2, Informative
      egrep = grep -E
      fgrep = grep -F
      $ ls -l /usr/bin/?grep
      lrwxrwxrwx 1 root root 10 2004-10-12 23:46 /usr/bin/egrep -> /bin/egrep
      lrwxrwxrwx 1 root root 10 2004-10-12 23:46 /usr/bin/fgrep -> /bin/fgrep
      -r-xr-xr-x 2 root root 33872 2004-04-06 06:56 /usr/bin/pgrep
      -rwxr-xr-x 3 root root 3456 2004-04-06 06:49 /usr/bin/zgrep
      --
      I speak England very best
    14. Re:Mine by Nailer · · Score: 2, Informative

      Nice post, but...

      > * [rs]sh - enables me to go places w/o passwords, copy files, and remotely execute commands. I can't live without it

      rsh has lots of known security vulernabilities and shouldd not be used at all.

      > * telnet - no, I never telnet to login to a machine, but I do it to test if a port is open, what's listening there, etc. very handy.

      You should use nc for this. Telnet will fail with lots of data, only does TCP, and can't listen on ports. nc handles lots of data, can do TCP or UDP, and can listen as well as send.

      > * Honorable mention - /bin/sh Only because it is always there by definition on UNIX systems, and a good shell programming language. tcsh, csh, and zsh are not as good as /bin/sh, and its always available, but a little boring to write about.

      True, but also, if the only Unix-like OSs you use are Linux, /bin/bash is there by definition. Functions, arrays, and other useful stuff.

  11. help please. by Anonymous Coward · · Score: 2, Interesting

    The autor makes a quick mention of vim, but what I'd really like to see is a full-blown developer session with vim, covering everything--common activities dealing with source, navigation, most used keystrokes, popular .vimrc mods, everything a "dyed-in-the-wool" GNU/Linux developer does when they are coding.

    To take it another step further, a peer review and commentary about the session from other hardcore GNU/Linux developers at the end, so I can see the critiques, favorites, etc.

    If anyone knows of such a article, or book, or could get such a thing started, I'd like to see it. The vim site is very helpful, but it is a lot more fragmented than what I'd like to see, something like "How the pros develop under GNU/Linux" with a full commentary/bull session attached...this would be very helpful to me.

  12. I got yer flamewar right here! by adavies42 · · Score: 5, Funny

    Wget sucks, curl rules!

    --
    Media that can be recorded and distributed can be recorded and distributed.
    -kfg
    1. Re:I got yer flamewar right here! by sootman · · Score: 2, Funny
      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
    2. Re:I got yer flamewar right here! by sootman · · Score: 2, Interesting

      I know the guy who used to admin RedHat's FTP servers. He had the server(s) set up so if anyone was using a download accelerator, it'd kill *all* transfers to that IP address.

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
  13. Telnet ...? by stevey · · Score: 5, Interesting

    It is suprising the author chose "telnet" as one of the programs in his list.

    Sure it is useful for diagnosing random problems, and troubleshooting things - for example connecting straight to a webserver, or simulating a POP3 login request, but I've always preferred netcat.

    netcat is much more useful, it allows you to bind to sockets and handling incoming requests as well as make outgoing ones this introduction is a good read.

    Missing tools from the list? curl, links/lynx, rsync, sudo, nmap, lsof, and less.

    1. Re:Telnet ...? by drinkypoo · · Score: 2, Insightful
      curl isn't missing - wget is right there :D

      rsync isn't missing - it's in the list.

      sudo, nmap, and lsof are all quite valid points, but many people don't bother with sudo. The main benefit of sudo is when you have many admins working on a machine. If you're not in such an environment, you really don't need sudo.

      less? I'd rather use vim as a pager :)

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    2. Re:Telnet ...? by kahanamoku · · Score: 2, Insightful

      Missing tools?

      what about the ability to login? I'd say the most important tool is the login prompt! cant do much without that one!

      Also, I think this article is really trying to teach us all how to suck eggs... this IS slashdot after all! ;-)

      --
      ----- Concentrate on promoting more than demoting.
    3. Re:Telnet ...? by JanneM · · Score: 3, Interesting

      The main benefit of sudo is when you have many admins working on a machine. If you're not in such an environment, you really don't need sudo.

      In Ubuntu the root account is not active by default, meaning you _always_ use sudo to do administrative tasks. And after geting used to that I feel distinctly uncomfortable with actually having a root shell open and unprotected on the Redhat box. If nothing else I know myself and know it's only a matter of time until I type something into the wrong terminal (and I know that from previous experience)...

      --
      Trust the Computer. The Computer is your friend.
  14. Re:Vim? Emacs foreva! by cayenne8 · · Score: 3, Insightful
    I find that sed and awk are two tools I use the most. Not so much for sys admin stuff...but, I get all kinds of fscked up files that need to be cleaned up for insertion into an Oracle database instance.

    They usually give me stuff in Excel format...gotta export it to csv file...then, clean out imbedded CRLF's, headings and such...especially with free form txt fields. Anyway, a little scripting and scrubbing with awk and sed...and I can generate some good insert scripts for the databases.

    --
    Light travels faster than sound. This is why some people appear bright until you hear them speak.........
  15. rm by Skadet · · Score: 5, Funny

    rm

    preferably with the -Rf options.

  16. Not a bad article by ansible · · Score: 2, Insightful

    But then, I've been using most of those tools for quite some time.

    The one that interested me is cdb, which I hadn't heard of before. I'll have to try that out.

  17. Webmin by lthown · · Score: 3, Informative

    One of the most useful remote admin packages out there. Especially useful for those just getting into Linux/Unix. Want to install a Perl module? just select or enter the name. Wanna change a cron job for a user, it's in the Cron screen.

    http://www.webmin.com/

  18. Re:SSH by kaarlov · · Score: 2, Informative
    ssh -p 25 mail.example.com
    is far less useful than:
    telnet mail.example.com smtp
  19. Make your own list! by sootman · · Score: 2, Insightful

    cat .bash_history | awk '{print $1}' | sort

    Mine: (flawed commands removed)
    cal
    cat
    cd
    cdd
    random text to get past lameness filter - isn't this why we have mods? size does matter!
    chmod
    clear
    cp
    crontab
    curl
    du
    echo
    grep
    random text to get past lameness filter - isn't this why we have mods? size does matter!
    gunzip
    head
    kill
    killall
    links
    locate
    ls
    lynx
    mkdir
    mv
    random text to get past lameness filter - isn't this why we have mods? size does matter!
    open
    pbpaste
    pico
    pine
    ps
    rm
    rmdir
    scp
    screencapture
    random text to get past lameness filter - isn't this why we have mods? size does matter!
    ssh
    su
    sudo
    tail
    tar
    telnet
    top
    touch
    unzip
    uptime
    which

    --
    Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
    1. Re:Make your own list! by Jeffrey+Baker · · Score: 2, Insightful

      $ awk '{print $1}' .zsh_history | sort | uniq -c | sort -rn | head -10
            2378 ssh
            1856 ls
            1246 cd
              496 mysql
              448 find
              431 wget
              428 man
              419 less
              407 su
              393 grep

    2. Re:Make your own list! by Andrewkov · · Score: 2, Funny
      C:\>cat .bash_history | awk '{print $1}' | sort

      'cat' is not recognized as an internal or external command, operable program or batch file.

    3. Re:Make your own list! by sootman · · Score: 2, Funny

      Mine:

      $ awk '{print $1}' .zsh_history | sort | uniq -c | sort -rn | head -10
      1 bash

      ;-)

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
  20. Cream for Vim by digitect · · Score: 4, Interesting

    I'll plug my own project here: Cream is Vim tricked out in single mode with all the development tools pre-configured with all useful shortcut keys self-documented in the pull-down menus. You won't need to go searching through the help ever again.

    --
    There is no need to use a SlashDot sig for SEO...
  21. Re:Vim? Emacs foreva! by drinkypoo · · Score: 2, Funny
    sed is my hero. When you have a directory full of mp3s named something idiotic like "band name (track number) song name - ( crack group ).mp3" it's nice to be able to do the following:

    Sorry, I was going to have an example of a for loop with sed, but I got busted by the lame filter. Seems like it gets harder to get past the stupid lameness filter all the time, yet I *STILL* constantly see goatse ascii. Why even fucking bother with the stupid thing if it doesn't work? You assholes.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  22. abcde? by ameoba · · Score: 3, Insightful

    When did a CD audio ripper become an essential part of an admin's toolkit?

    --
    my sig's at the bottom of the page.
  23. PS by sootman · · Score: 2, Funny

    Just kidding.

    http://curl.haxx.se/docs/faq.html

    1.3 What is curl not?

    Curl is *not* a wget clone. That is a common misconception. Never, during
    curl's development, have we intended curl to replace wget or compete on its
    market. Curl is targeted at single-shot file transfers.

    --
    Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
  24. Re:SSH by drinkypoo · · Score: 2, Informative

    telnet is the program that lets you test SMTP by connecting to 25/tcp, unlike ssh.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  25. Re:Vim? Emacs foreva! by Anonymous Coward · · Score: 3, Funny

    Sorry, I was going to have an example of a for loop with sed, but I got busted by the lame filter. Seems like it gets harder to get past the stupid lameness filter all the time, yet I *STILL* constantly see goatse ascii. Why even fucking bother with the stupid thing if it doesn't work? You assholes.

    Obviously and sadly, the gay niggers are intellectually superior to you.

  26. My favorite by diagonalfish · · Score: 2, Funny

    apt-get update ; apt-get dist-upgrade

    Oh. Not everyone uses Debian, right, sorry. They should, though. *mumbles*

    --
    "Eddies," said Ford, "in the space-time continuum." "Ah," nodded Arthur, "is he? Is he?"
  27. Re:SSH by fimbulvetr · · Score: 4, Informative

    I'm actually suprised this guy used telnet. I find netcat (man nc) as a much better alternative. I can script it, I can do udp, and I can do port "testing".

  28. Without a doubt: tcpdump by mybecq · · Score: 2, Informative
    When you absolutely, positively have to know why your system isn't interoperating with the rest of the network, tcpdump will provide the answer. That is, assuming you know what it all means.

    There's no easier way to lay the blame squarely in the Windows camp (or to eat your hat)...

    A few diagnoses I've performed:
    • Providing the exact query in a web-developers app that was causing major problems
    • IE doesn't work with proxy because it sends invalid HTTP/1.0-formatted requests.
    • Connection to AD only works intermittently because your LDAP bind limit of 5 seconds is not long enough
    • Latency through the roof due to email/web/etc
    • Service unavailable because remote port is not listening
    • etc...

    I would say tcpdump is the #1 program for serious problem-solving -- at least with the work I did...
  29. Depends on the admin role I'm in by jd · · Score: 4, Informative
    For network administration, I'd probably have a top 10 of:


    • hping3
    • bing
    • pchar
    • ping
    • traceroute
    • ncat
    • tcp dump
    • webmin
    • wget
    • ngrep


    Now, some of those are "well-known", but there are plenty there that few people (even on Slashdot) are likely to be overly familiar with.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  30. Re:Vim? Colour hell! by sylvandb · · Score: 2, Informative

    when I have to change a word ([^ ]+) up to the next space, my screen ends up full of yellow blocks.

    Worst vi enhancement ever!

    (yes I know about :syn off)


    But do you know about :nohls (to disable HighLight Search results until the next search) or :set nohls (to disable for the session)?

    I quite often benefit from highlighting my search results. But when they annoy me, I simply turn off the highlighting.

    Definitely a good vi enhancement.

    sdb

  31. great tools by codepunk · · Score: 3, Informative

    All the best tools are the great networking tools which allow me to track down and eradicate owned windows machines on the network.

    nmap - hmmm what trojan do we have on the network today
    tcpdump - great at finding worms scanners
    iptraf - for finding weird clients p2p movie downloaders etc.
    ethereal - great for grabbing pop and telnet passwords
    aimsniff - just for amusement

    With just those couple of tools I can keep the helpdesk busy for weeks by finding owned machines that need cleaning.

    --


    Got Code?
  32. I prefer this one by toofast · · Score: 2, Interesting

    cat .bash_history | awk '{print $1}' | sort | uniq -c | sort -nr | head -20

  33. Maybe a few lesser-known by toofast · · Score: 4, Informative

    ethtool and mii-tool. The Cisco 2970 switch we use has the knack of initializing the interface in half-duplex mode if the port is set to "Auto". Easily fixed by setting the port to Full, but useful nonetheless.

    strings. Good to check if executables are using /etc/hosts.allow and /etc/hosts.deny, or where pop3/imap are looking for PEM certificates to configure pop3s/imaps, etc...

    vmstat. Think your system is paging, or a card is generating too many interrupts? /proc filesystem. Favorites include /proc/net/dev, and /proc/uptime, /proc/cpuinfo, /proc/loadavg. Good for aggregating individual server load data in a cluster.

    awk and sed. Mentioned elsewhere, but priceless.

    chmod. I think the Linux filesystem permissions are too ... permissive. Cut down on access to your logfiles and to config files in /etc.

    *quota*. A must for restricting disk space use.

    umask. When you need root, set your default umask fairly tight. I use 0077, but when you need to cpan some common perl modules, switch to the more common 0022.

    jobs, fg and bg. Old-school unix commands to play with jobs that .. might take a while. When you forgot to & your command, use CTRL+Z then bg your job.

    There may be more, but I can't think of any others right now...

    1. Re:Maybe a few lesser-known by Nailer · · Score: 2, Informative

      > strings. Good to check if executables are using /etc/hosts.allow and /etc/hosts.deny, or where pop3/imap are looking for PEM certificates to configure pop3s/imaps, etc...

      Sure, but ldding the binary is a better way to discover is the app supports TCP wrappers.
      ldd /usr/sbin/sshd, for example, mentions libwrap.so

      But really, whether an app uses TCP Wrappers or where it looks for SSL certificates should be documented plainly. I think /etc/pki may also be an upcoming FHS standard for certificates too.

      strings is still handy tho - to find out what a binary from a rootkit does, without running it.

  34. GNU Screen. by SlapAyoda · · Score: 3, Interesting

    I'm surprised at how few serious *NIX Administrators I know are using GNU Screen. For some reason, it seems that the majority of them have not yet discovered the sheer power of the console window manager. It allows me to manage dozens of virtual windows all within the same terminal. In addition to eliminating the need to window-switching on my local machine, it also allows me to perform complex select, copy, and paste operations using only my keyboard. WIthout using a mouse, I can select and copy text in one window, advance into another window, and paste the text. The best part is that if my DSL drops or I decide to reboot my computer, all of my screened sessions stay on the server, leaving my work in exactly the same place as it always was, and with a nice scrollback history. I couldn't work without it.

    --
    # wrote sig.txt, 23 lines, 31337 chars
    1. Re:GNU Screen. by darkwhite · · Score: 2, Informative

      Concur. But even more importantly, screen by default doesn't come with any sort of on-screen window list. This .screenrc line makes a screen session tremendously more comprehensible to me:

      backtick 1 0 0 whoami
      caption always "%>%{kw}%1`@%H %{bw}%?%-Lw%?%{bW}%n*%f %t%?(%u)%?%{bw}%?%+Lw%?%"

      This will put a caption at the bottom of the screen listing your open shells and highlighting the current one.

      --

      [an error occurred while processing this directive]
    2. Re:GNU Screen. by darkwhite · · Score: 2, Informative

      Also, put this in your ~/.bash_profile:

      if [[ `who -m` ]] ; then
                      [ -z "$WINDOW" ] && screen -xdR
      fi

      to start screen automatically on terminal logins and grab the previous screen session.

      --

      [an error occurred while processing this directive]
  35. Re:Other comments on GNU Screen? by Wizarth · · Score: 5, Informative

    Screen is very useful. I think of it as providing virtual terminals (you know, Ctrl-F1 to Ctrl-F6) but over remote login (usually ssh in my case)

    My normal usage is like so:
    ssh into the box
    screen -r (resume session, that was created first time I went in after bootup, with screen -S)
    Ctrl-A Ctrl-N (next virtual terminal) to flick through things i have running, usually centericq (text multi protocol chat client) and btdownloadcurses, or the results of a compile I left going.
    Ctrl-A Ctrl-C (open new virtual terminal) which gives you another command prompt. Here I'll wget a tarball, extract it, start the compile, then Ctrl-A Ctrl-N back to centericq

    I'll disconnect from the box (Ctrl-A Ctrl-D to disconnect from screen, then Ctrl-D to close the login shell), go home, reconnect from one of my other machines, go through the same process.

    Also, I can stay connected, go to another machine, and use screen -x to have multiple connections to the same screen. In the case of a dropped connection, and screen thinks my old login is still valid, screen -rD will disconnect the old login.

    Oh, and Ctrl-A ? will show all the in-screen escape sequences. Some of them I haven't used (there is one to do horiz split display, but it crashes btdownloadcurses), but look like they could be even more useful!

    But really, the best part is not having programs killed on me because the internet connection dropped (as happens all too often around these parts).

  36. Re:Other comments on GNU Screen? by jptxs · · Score: 3, Informative

    Step 1. Begin compiling some huge thing (tm) during your screen session.
    Step 2. Spend all day doing other things as compilation is off in some hidden window in screen.
    Step 3. Check on compiling every now and then, you will be able to scroll back and forth as needed as if you'd been sitting with an xterm open the whole time.
    Step 4. Leave work for home.
    Step 5. Reattach to you screen session and check on your compiling some more.
    Step 6. Realize inner peace knowing you need not worry about where you started some long process ever again by using screen.

    --
    we speak the way we breathe --Fugazi
  37. Fuel for the fire by ctr2sprt · · Score: 2, Interesting
    I'll go ahead and add my list of tools I find myself using all the time. Note that because I admin more than just Linux boxes, I only use tools which are likely to be present on every Unix variant.

    • find. It can be a handy ps replacement for boxes you think might be rooted (find /proc -name exe) in addition to all its other uses.
    • xargs. Everyone uses it with find, but it's also good with...
    • awk and/or cut. Need to reset quotas for 900 users? awk -F: '{if($3 >= 1000) print $1)} | xargs edquota -p protouser.
    • sh. If you need to run more than one command via xargs, you can use a while loop in sh. I actually prefer tcsh as my interactive shell because of its nifty history-completion feature, but it's weaker at scripting.
    • sort and uniq. They get one item because I almost never use them individually. Your webserver's getting DoSed and you want to know what IPs to firewall? netstat -an | awk '$4 ~ /:80$/ {print $5}' | cut -d: -f1 | sort | uniq -c | sort -n.
    • grep -v. Yes, the -v is part of it: I almost never use regular grep for some reason. -v does the opposite of usual grep and excludes matching lines, which for me turns out to be much more useful.
    • telnet. Same reason as in TFA. I mainly use it as a quick way to see if relaying is actually disabled or not, or if a service is hung. (Running according to ps, listening according to netstat, accepting connections, but not doing anything.)
    • less. Mainly because some versions of more are worthless and won't allow you to scroll up, for example.
    • vi. You need an editor, and once you climb the sheer face of vi's learning cliff, this is good at it. I still can't stand to use vi for coding, but for writing and adjusting config files it's great. Also it's pretty much the only editor guaranteed to be in all of Solaris, HP-UX, IRIX, FreeBSD, and RedHat Linux, so it's not like I have much of a choice.
    • ssh. The all-purpose Swiss Army Chainsaw of networking. If you need to move data across a network, ssh can do it. It may be complicated, painful, and slow, but by God it can be done. ssh outer ssh border ssh inner tar czf - / | ssh storage 'cat >inner.tar.gz'.

    There are other useful tools, but I pretty much use those on every single box I touch for any reason.

  38. My Ten Would Be... by Shads · · Score: 2, Interesting

    ... (as a sysadmin)

    grep - Simple, Powerful, Elegant
    sed - Powerful and versitile
    awk - For what sed doesn't do easily
    perl - For what awk doesn't do easily
    vim - In the end there can be only one... it's vim.
    cut - is your friend
    make - automation is good and make makes it easy
    lynx - great for testing web stuff
    slrn - news, it keeps you sane after being locked in the closet for a month
    mtr - just flatout helpful

    --
    Shadus
  39. 'kill -9 1' will get you laid by Flunitrazepam · · Score: 3, Funny

    How about that? Run it and your social life will immediately improve. It is the first step toward a better life. Won't you take it today?

    --
    1) Your analysis is based on bad assumptions so your result is way off. 2) You're a sick bastard for fucking a horse.
  40. There is only one by sl4shd0rk · · Score: 2, Insightful

    Knoppix.

    --
    Join the Slashcott! Feb 10 thru Feb 17!
  41. Re:Vim? Emacs foreva! by drinkypoo · · Score: 2, Funny

    Obviously and sadly, the gay niggers are intellectually superior to you.

    I don't have any problem with that, I'm secure in my race and my sexuality. What I find amusing is that the gay niggers are intellectually superior to the people writing the lameness filter.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  42. You may wish to read first by WindBourne · · Score: 2, Funny

    Plain and simple, zonk points out that you can not work all the time. Having that available allows you to rip to your local machine and then listen to them as you work. Made total sense to me.

    --
    I prefer the "u" in honour as it seems to be missing these days.
  43. Re:Vim? Emacs foreva! by hackstraw · · Score: 2, Informative

    (I didn't know this until I learned emacs many years ago and realized that C-a and C-e worked in bash too. Then I noticed, hey, so does C-t, C-p, C-n, etc. C-r [isearch-reverse] is now my favorite bash feature, thanks to emacs. I always like it when learning one thing [emacs] makes another easier [bash].)

    As for vi, I know how to do basic stuff in it, but it basically upsets me. I have a wrt54g that doesn't have emacs on it and editing config files is a PITA. Why doesn't vi let me go to the end of the line by pressing, say, end or going to the end of a shorter line and then pressing the up arrow? Irritating. I know a vi guru is going to explain how to do this now, but I don't really care about the answer. What am I going to do the next time I'm stuck in vi and have a problem? (Hint: ESC :q!


    Disclaimer, I don't care what you or my neighbors use for a text editor, nor do I care what kind of toilet you prefer to take a dump in. Its not that big of a deal.

    I will say, that I find it a little strange that shells come with emacs bindings, when vi is kinda the default. I'm saying this because vi (or for some historical reason, ex) is the default editor and bindings in things like less and more. Aside from ^e and ^a, I don't know any other emacs commands. I do know that most shells will take vi commandline editing commands. Honestly, I forgot how to do this in my shell, zsh. Or maybe its the default. One of the things I like about zsh is that it is the only shell that correctly does multiline editing in vi mode, or at least it was. bash was unusable and broken at least in the past, there is no reason to change now.

    Oh, and going to the end of the line and beginning of the line in vi uses the carat ^ to the beginning and $ to go to the end. I've never tried keys that are on the dark side of the keyboard (where my hands aren't), so I don't know about that. The ^ and $ are not that foreign, because they are used to denote the beginning and end of lines in regular expressions. Intuitive? No. Easy to remember and associate with other stuff that I do every day, yup.

    As for vi, I know how to do basic stuff in it, but it basically upsets me. I have a wrt54g that doesn't have emacs on it and editing config files is a PITA.

    Again, I don't care. But I will say that emacs is not a standard UNIX thing, vi is. vim, my favorite editor, is not. I too have to deal with using "plain vi" sometimes. Its close, but certainly no cigar. I will say, that it is frustrating to work with someone that does not know vi at all. I'm not saying guru, but at least the basics. I would say that ^ and $ are a little beyond the basics, but it is something that someone should be able to pick up and remember after the first time of hearing about it.

    Again, vi, vim, or emacs are not better. vim and emacs have been in active development and used extensively over the years. They are both powerful editors. But everybody needs to learn the basics of vi if they are going to be using UNIX systems. Its one of those things. You do not have to like it.

  44. Re:CD Ripping by dulridge · · Score: 2, Funny

    A rubber hammer - you lack ambition. A 4lb bricklayers hammer works far better. Learned this one 25 years ago when I worked in a camera shop.

    Repairs to fiddly bits of cameras are best not attempted while severely hungover - especially the morning after someone has tried to break in through the window in the basement. Anyway customer comes in with jammed camera - this model (Russian Leica 3 clone) easy to fix once the top plate removed so wandered through the back to get small screwdrivers. Meanwhile boss in basement trying to fix broken window and yells up for me to bring down hammer.

    Customer sees me emerging from the back of the shop wielding a hammer. His expression truly terrified at the thought of my attempting percussive maintenance to his camera with it. He had not been reassured by the aroma of stale whisky either and I've never seen anyone leave the shop so fast before or since.

    Much relief when I wandered down to the basement with the hammer. Ever since then a 4lb hammer has been in the toolkit as the customers tend to shut up and let you get on with it once you have produced that. Only time it ever got used was when trying to make an antique colour laser printer fit in a skip. Now that WAS fun, if a little sad - that beast earned me something like its purchase price over the years when it played up.

  45. Re:indispensable: zsh & mmv by Florian · · Score: 2, Informative

    Besides from being shorter, mmv doesn't stop there. Your example doesn't scale to multiple replacements within one string, i.e. 'mmv "*_*.htm" "#1-#2.html"'. But above all, your example isn't safe. You could avoid filename collisions and accidental overwriting by aliasing "mv" to "mv -i"; however, that still wouldn't give you a complete check in advance, but make the command exit half-finished and non-reversable. mmv on the other hand cancels the operation before doing anything if there are any name collisions. - If you try to put all these features and safety measure into your shell script, you will probably end up with something that is as complex as the the C sourcecode of mmv...

    --
    gopher://cramer.plaintext.cc http://cramer.plaintext.cc:70
  46. Re:Vim? Emacs foreva! by crazyvas · · Score: 2, Informative
    Emacs, OTOH, has a keybinding style that translates great to other apps. GNU apps all use emacs keybindings (I wonder why), and even IDEs like eclipse have compatibility modes. I'm glad I'm not a vi user because I know I would never be able to get things done in GUI programs like eclipse.

    Vi plugin for the Eclipse editor: http://www.satokar.com/viplugin/

    Anyway, if you use a GNU system like Linux, you should learn emacs. Bash (readline), info, etc. all work just like emacs. It will really save you time and effort when every app uses the same keystrokes. C-t is a great timesaver in both bash and emacs.

    Glad you realized you can use emacs keystrokes on bash. This doesn't mean much for emacs though. Bash allows for either emacs or vi keystrokes to be used. Type "set -o vi" to get it it use vi keystrokes, complete with the two modes. "set -o emacs" (which happens to be the default) to use emacs.

    Also note, that while info might use keybindings similar to emacs, 'less', which is one of the most often used commands, uses vi keybindings.

    Why doesn't vi let me go to the end of the line by pressing, say, end or going to the end of a shorter line and then pressing the up arrow? Irritating. I know a vi guru is going to explain how to do this now, but I don't really care about the answer.

    Next time you don't really care about the answer, please do us a favor and quit blaming it on vi.

  47. Instead of cdargs... by Clueless+Moron · · Score: 3, Informative
    I define these functions in my shell .rc:
    mk() { eval ${1:-MKPWD}=\"`pwd`\"; }
    rt() { eval cd \"\$${1:-MKPWD}\";pwd; }

    You type "mk" (as in "mark") and "rt" (as in "return") to mark a directory and later go back to it.

    Or you can give it a name: do "mk foo", and later on "rt foo" will move you back there.

    But the Big Win? With the above, it gets set as a shell var: $foo is also set to the directory, so you can do things like "cp $foo/*.baz ." to good benefit. In addition, setting up this system is just a trivial matter of setting environment variables in your .profile.

    PS: Trivia: the "mk" and "rt" names were inspired by troff, where those commands were used to keep mark and go back to vertical positions on a page... yeah I'm an oldie.

  48. Re:SSH by hazem · · Score: 2, Informative

    If you need to automate something like telnet or ftp (or anything interactive on the command line), "expect" allows for some very powerful scripting.

    It "expects" certain things and provides an appropriate output.

  49. sed by donweel · · Score: 2, Insightful

    I found sed to be usful when I was writing shell scripts. Find for shure. And to amuse myself wall, for example, fortune -o | wall (add escape codes to kill your banner). Also ps can be important when things go wrong.

    --
    Many a long talk since then I have had with the man in the moon; he had my confidence on the voyage. Joshua Slocum
  50. Re:SSH by Pheersome · · Score: 4, Informative

    I was actually going to say something very similar, and then I realized that I use telnet over netcat for certain purposes, because telnet notifies me when it actually connects. However, a couple minutes ago I realized I was being an idiot, because 'nc -v' does the same thing.

    Also, if you haven't already, check out nmap-ncat.

    --
    Better to light a candle than to curse the darkness.
  51. Elinks rocks... by arcadum · · Score: 3, Informative

    Elinks has javascript support. I've deployed elinks to many systems as a last resort for the tech support crew when the ppp connect is hosed.

  52. Tsync by Earlybird · · Score: 3, Interesting

    You may want to check out Tsync, one of the recent Google "Summer of Code" winners: "Tsync is a user-level daemon that provides transparent synchronization amongst a set of computers. Tsync uses a peer-to-peer architecture for scalability, efficiency, and robustness." Unlike rsync, Unison, etc., Tsync is a locally installed daemon which automatically and transparently syncs two or more hosts.

  53. dmidecode! by Nailer · · Score: 2, Informative

    Your /proc stuff if great, here's a handy accompaniment: ever logged onto a system and had no idea what it is? Maybe a crappy Dell Poweredge or whiteboxx kit, maybe a nice solid IBM/HP box? Wanted to get the system's asset tag for support reasons?

    dmidecode. Part of the kernel-utilss package on most Linux distros.

  54. multitail by flok · · Score: 2, Informative

    Sorry for plugging my own project but I think MultiTail can be very usefull for a lot of admin tasks. MultiTail lets you view one or multiple files like the original tail program. The difference is that it creates multiple windows on your console (with ncurses). It can also monitor wildcards: if another file matching the wildcard has a more recent modification date, it will automatically switch to that file. That way you can, for example, monitor a complete directory of files. Merging of 2 or even more logfiles is possible. It can also use colors while displaying the logfiles (through regular expressions), for faster recognition of what is important and what not. It can also filter lines (again with regular expressions). It has interactive menus for editing given regular expressions and deleting and adding windows. One can also have windows with the output of shell scripts and other software. When viewing the output of external software, MultiTail can mimic the functionality of tools like 'watch' and such. For a complete list of features, look here. Multitail can be found here: http://www.vanheusden.com/multitail/.

    --

    www.vanheusden.com - home of Multitail, HTTPing, CoffeeSaint, EntropyBroker, rsstail, bsod, listener, nagcon, nagi
  55. Oh yeah? (pr0n howto) by identity0 · · Score: 3, Informative

    As this table shows, curl does not have "Recursive Downloads", which wget does. Which is the most useful feature of wget - you can point it at a pr0n link or gallery site like so:

    wget -r -k -H --level=3

    and it will follow all the pr0n links to three levels down, and retrieve all the pix/movies it links to. Saves you tens of hours of frustrated clicking and saving manually. Not that I personally use it for such vile things, of course :)

  56. Here's my list by insomaniac · · Score: 2, Interesting

    Here is my list of tools I can't live with in my admin life:

    #1: vim (My editor of choice for anything)
    #2: netcat (beats telnet for the network testing forte)
    #3: ssh-agent/ssh (for secure remote logins and other nice tricks (like tarring over ssh)
    #4: nmap (for a quick network scan to see what hosts are up in an unknown network or an in depth portscan of a particular machine)
    #5: perl (who needs shell script when you have perl ;))
    #6: mtr (cause traceroute is sooooo 1980's)
    #7: screen (for those long taking operations on a bad network connection)
    #8: grep (the all purpose filter/text finder with -r)
    #9: find (flexible find/recursive operations tool)
    #10: host (quicker and easier name resolves than dig)

    --
    The way to corrupt a youth is to teach him to hold in higher value them who think alike than those who think differently
  57. My list... by ledow · · Score: 3, Interesting

    - ssh (file transfers, port forwarding, encryption and remote login in one tiny tool. I even use it in place of WEP or WPA)
    - pico (can't stand vi but pico is small and has enough of a help that I don't have to memorise keystrokes)
    - grep, sed (with grep and sed, you can pretty much manipulate any file/program output into whatever you want, strip IP's out of errors/logs, etc.)
    - x11vnc (like any other VNC program but supports Tight encoding and also lets me see what an EXISTING X session is doing. Combined with a script that seds/greps the auth code from the process list and you have automated remote desktop)
    - screen (if for no other reason than it lets you start a job at work (like a kernel compile) and watch it's progress throughout the day even if you have to log off in between. And when you get home, you can still check on it)
    - tinyproxy (wonderful small, easy to use web-proxy that I tunnel into from work to bypass the far-too-restrictive filters in the schools that I work in)
    - slocate (worth it's weight in gold when you have it auto-indexing overnight across all filesystems. Where's that file I used ten years ago that had Xen in the name? a simple command, 2 seconds wait and you get the full path).
    - dnsmasq (tiny util, bung it a massive list of public DNS servers and point your DNS requests to 127.0.0.1 and it will loop through them all until it gets a response. Failover to other servers, built-in full DHCP server, invaluable behind a NAT, simple config. Saved my life I-don't-know-how-many-times when my ISP DNS servers were feeling flaky. No one even noticed that half the time our ISP's weren't responding to DNS at all.)
    - lsusb, lspci, /proc/cpuinfo, free etc. (Invaluable for hardware discovery. Boot a knoppix CD, run those commands and instantly you know everything about the hardware that you need to know.)
    - dd, cat, more, sh, etc.(where would we be without them?)