After administering Unix or Unix-like servers, what tools (command-line preferably) do you feel you cannot live without?
|
feedback
|
closed as off topic by MDMarra, DJ Pon3, Iain♦ Feb 26 at 12:59
Questions on Server Fault are expected to generally relate to servers, networking, or desktop infrastructure, within the scope defined in the faq.
|
GNU screen - essential when you're managing large numbers of systems and don't want to have a dozen terminal windows open. | ||||
|
feedback
|
|
Some I know that I cannot live without...
| |||||||||
feedback
|
|
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) | |||||
feedback
|
|
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. | ||||
|
feedback
|
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. | ||||
|
feedback
|
|
[rsync][1], especially in concert with ssh. It allows simple efficient copying of files from host to host. How did we ever cope without ssh and rsync? :-) | ||||
|
feedback
|
|
Netcat.
The network swiss army knife, as they say. | ||||
|
feedback
|
|
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. | ||||
|
feedback
|
|
For quick scripts, automation, etc:
To connect to your *NIX server:
| |||||
feedback
|
|
I use most of the tools already listed, but here's one no one has touched on yet:
| ||||
|
feedback
|
|
Most of the standard ones are included in other answers, so I'll go fo non-standard ones: | ||||
|
feedback
|
|
A couple of handy tools I haven't seen mentioned yet:
| ||||
|
feedback
|
| ||||
|
feedback
|
|
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. | ||||
|
feedback
|
|
Seriously though, | ||||
|
feedback
|
|
Some that haven't been mentioned before:
| ||||
|
feedback
|
|
zsh as a shell It is especially efficient with grml.org's extensions/setup. | ||||
|
feedback
|
|
Most of these tools are 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 - for example, "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:
Certainly this is true on Ubuntu and Debian. You may need to get the package on some Linux distributions. | ||||
|
feedback
|
|
Some additional answers can be found in this similar question | ||||
|
feedback
|
|
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. | ||||
|
feedback
|
|
man - to read the man pages. elinks - to check google, cause I sure as hell cant remember everything. And attention to detail & tenacity, because without them I just waste time. | ||||
|
feedback
|
|
iotop, is a top-like program to monitor I/O accesses to your disks. | ||||
|
feedback
|
|
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. | ||||
|
feedback
|
|
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:
| |||||||||
feedback
|
|
A few things overlooked I wanted to mention.
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. | ||||
|
feedback
|
|
One tool sometimes very handy is nohup. I use it to run scripts that last for a long time using remote SSH clients. | ||||
|
feedback
|