vote up 20 vote down star
35

After administering UNIX or UNIX-like servers, what tools (command-line preferably) do you feel you cannot live without?

flag

38 Answers

1 2
vote up 31 vote down

GNU screen - essential when you're managing large numbers of systems and don't want to have a dozen terminal windows open.

link|flag
vote up 25 vote down

some I know that I cannot live without...

  • tee - allows simultaneous writing to STDOUT (standard output) and a file. Great for viewing information and logging it for later.

  • top - the task manager of UNIX, gives a great overview of the system.

  • tail -f - allows you to view appended data as a file grows, great for monitoring log files on a server.

  • grep - Global Regular Expression Print, great for searching the system for data in files.

  • df - reports disk usage of current filesystems.

  • du - reports disk usage of a certain file/directory.

  • less - needed to view man pages! also useful for viewing output of commands in an easily seekable manner.

  • vim/Emacs/nano/pico/ed - whatever your text editor of choice may be, self explanatory of why it's needed.

link|flag
4  
Another useful but little known feature of less is that you can always use the 'v' command to start editing the file you're currently looking at. Mnemonic is 'v' for 'vi'. – dr-jan Jun 1 at 14:20
show 4 more comments
vote up 19 vote down

lsof to determine which processes are using a file or directory (useful when trying to figure out what is preventing a device from being umount'd)

netstat to determine which processes are using network connections (especially useful when trying to figure out which daemon is bound to a certain port)

link|flag
show 2 more comments
vote up 14 vote down

Learn all the basic tools, but learn Perl.

Perl is ideal for manipulating text, and since un*x operators live on text files, pipes, input and output, Perl is a great fit.

The added bonus is Perl is cross platform and if you have to do some work on a windows box you have an easily installable (just drop a Perl directory on the server) language that you already know.

And on that train of thought, get Cygwin as well. If you are a un*x admin and have to work on a windows box (even your desktop) having ls, rm, grep, sed, tail etc save you a lot of time when switching OS's.

link|flag
vote up 10 vote down
  • sed
  • awk

The forgotten grandfathers of modern systems scripting. I know Perl gets most of the love (along with Bash scripting, Python, Ruby, and [insert your favorite scripting language here]), and don't get me wrong, I love Perl. I make use of it almost daily.

But sed and awk should not be forgotten, overlooked, or ignored. For a lot of cases, sed and awk are the best tools for the job. Quick examples are command line filtering with sed, and quick and dirty log processing with awk. Both could be done in Perl, but will require more work and development time.

link|flag
vote up 8 vote down

rsync

especially in concert with ssh. Allows simple efficient copying of files from host to host. How did we ever cope without ssh and rsync? :-)

link|flag
vote up 7 vote down

For quick scripts, automation, etc:

  • bash
  • perl

To connect to your *NIX server:

  • Open SSH (Linux client)
  • Putty (Windows client)
link|flag
1  
+1 for ssh . – Jeremy Huiskamp May 4 at 4:48
vote up 7 vote down

face it - sooner or later you'll deal with the network as well. mtr, tcpdump and tshark are really useful for seeing what's happening.

link|flag
vote up 7 vote down

Netcat.

  • Test if TCP services are listening.
  • Perform transactions against plaintext protocols such as SMTP.
  • Quick insecure data transfers between machines.
  • Telnet client emulation.

The network swiss army knife, as they say.

link|flag
vote up 6 vote down

For scripting:

link|flag
vote up 5 vote down

ClusterSSH

ClusterSSH controls a number of xterm windows via a single graphical console window to allow commands to be interactively run on multiple servers over an ssh connection.

link|flag
show 1 more comment
vote up 4 vote down

Most of the standard ones are included in other answers, so I'll go fo non-standard ones:

  • htop — great for process management;
  • pinfo — lynx like browser for info and man pages.
link|flag
vote up 3 vote down

ssh, vim, htop, su, python, ls, cd, screen, du, tar :)

link|flag
vote up 3 vote down

zsh as a shell

It is especially efficient with grml.org's extensions/setup.

link|flag
vote up 2 vote down

sudo.

Seriously though, tail -f is useful.

link|flag
vote up 2 vote down

Some that haven't been mentioned before:

  • head/tail
  • diff
  • pstree
  • tar
  • gzip/bzip
  • watch
link|flag
show 1 more comment
vote up 2 vote down

A couple of handy tools I haven't seen mentioned yet:

  • dstat --nocolor (overview of cpu-, disk-, net-usage)
  • iftop (nice dynamic overview of network traffic)
  • ccze (colour logfiles nicely)
  • ssh tunnels (can be useful once in a while; see the manual; -R)
  • expect (automate interactive, chatty dialogy interfaces, nice if you're in a pinch)
link|flag
show 1 more comment
vote up 2 vote down

I use most of the tools already listed, but here's one no one has touched on yet:

Puppet - system for automating system administration tasks

link|flag
vote up 1 vote down

Some additional answers can be found in this similar question

link|flag
vote up 1 vote down

Most of these tools made much more powerful using bash "programmable completion" - so you can tab-complete things like commandline options, or say the name of a package with "apt-get install". It will also limit what you tab-complete for relevant files - eg "unzip" will only complete supported archive files.

It really is the mutts - if you have never tried it you probably just need to fiddle your .bashrc:

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
 fi

Certainly this is true on ubuntu and deb. You may need to get the package on some distros.

link|flag
vote up 1 vote down

tar pipe!

piping the output of tar to another utility, to tar running on the same box, or to tar running over SSH is my favorite old-school Unix move for moving files from one place to another.

This also gives you the Windows-style option of copying one folder to another and ending up with all of the files in the source and destination directory.

link|flag
vote up 1 vote down
  • rsync running over ssh to keep things consistent... in multiple directions (-gloptru[n]c)
  • vim and vimdiff to edit with 'folding' and viewing differences in scripts, logs, etc
  • perl and (ba)sh for scripting and analysis
  • curl (and maybe wget) for posting/fetching data from ...
  • apache to webify them all (or at least create point-n-click admin tools)
link|flag
vote up 1 vote down

perl and vim. In that order. Anything else, I can use perl to emulate somehow.

link|flag
vote up 1 vote down

pv: Displays the progress of long operations that can be redirected. http://www.ivarch.com/programs/pv.shtml

Useful then you want to monitor something that is going to take ages, like copying/compressing a raw block device over the network (which is how I take paranoia backups of my 8Gb netbook before tinkering with anything major like tweaking with file system settings).

Also: I'll second votes for ssh, rsync, screen, htop and netcat as mentioned by people above - all of which are more important than pv but pv had not been mentioned yet. In fact pv is often a useful addition when piping stuff to or from to netcat.

link|flag
vote up 1 vote down

These are the tools I use on a daily basis (as a developer more than a sysadmin)

  • zsh
  • lsof
  • ps
  • ack (or grep)
  • find
  • svn
  • python
  • tar
  • which
  • fortune (a guy has to keep his sanity somehow)
link|flag
vote up 1 vote down

  • vi
  • find
  • ssh
  • awk
  • sed
  • netcat
  • tar
  • ps

  • link|flag
    vote up 0 vote down

    Simple, basic but still essential:

    ps - report a snapshot of the current processes.

    free - Display amount of free and used memory in the system.

    w - Show who is logged on and what they are doing.

    link|flag
    vote up 0 vote down

    pkill or ps for killing processes.

    If you want to use ps to kill any process with a given name or under a certain directory blah (or any matching string you require) you can:

    kill `ps -ef | grep <blah> | grep -v grep | awk '{print $2}'`
    
    link|flag
    show 4 more comments
    vote up 0 vote down

    vmstat 1

    Gives you a great overview of system behaviour.

    link|flag
    vote up 0 vote down

    A few things overlooked I wanted to mention.

    • vim -d split screen console diff that makes it very easy to see the differences in a file
    • pdsh allows you to easily run a command over as many systems as you want either serial or parallel(I am a cluster admin. I can't function without it.)
    • nmon is like top on crack. It gives you a great idea of what is going on on a system on a single screen. You can see disk I/O, network I/O CPU usage, and memory usage real time. At the very least a real fun thing to play with when profiling a system.

    Oh, and I forgot to mention, when scripting, I believe you should always use Korn. I hate Korn(Not the band. I love the band:-P) but it's literally everywhere. You can take a script and move it between Solaris, AIX and Linux and not have to worry about whether or not the admin had the decency to install Bash.

    link|flag
    1 2

    Your Answer

    Get an OpenID
    or
    never shown

    Not the answer you're looking for? Browse other questions tagged or ask your own question.