It always amazes me how much time some system administrators waste because they don't take a bit of time to learn the tools of the trade.
I recall how, many years ago, a man was sitting in a C programming course I
was giving. The chap was quite clever, and he grasped the language quickly
enough. However, he was never able to complete the exercises in a timely
manner, because he was a lousy typist. As such, I would have expected him to
take shortcuts in typing, by, say, creating a one-line shell script to compile
his program, but no, he insisted on entering the
cc -o example example.c
command line time and time again, sometimes mistyping half a dozen times while
I was standing behind him checking on his progress. They guy drove me up the
Here's a little rant. I'm assuming you use bash or an equivalent, but most of these work in whichever shell you are using: RTFM.
Believe your commands
You've just removed a file with a
rm file and you didn't get a diagnostic
message? The file is gone. Trust me: it's verschwunden and won't be back. You
don't have to
ls to see it's gone. Same for
mkdir: no error? The directory
was created. How difficult is that? In fact the men who designed UNIX did it
so you can actually do
mkdir newdir && cd newdir. Do you believe that's a
One of the biggest time wasters of all. Watch this:
cd /etc ls passwd vi passwd cd .. cd home cd myuser cd myfiles vi something # oh: I forgot something ... cd /etc vi passwd cd .. cd home cd myuser ...
For goodness sakes! What ever happened to
vi /etc/passwd which keeps you
where you are? And if you really do want to change into a different directory,
do it properly:
cd /some/place/or/other vi ... cd -
cd - takes you back to where you where. And if you really want more
power, look at
Place (colored) windows in a standard location
It is not infrequent for a sysadmin to have dozens of windows open simultaneously. What I often see is guys ALT-TABbing themselves to death in search of the window they want to work in.
Place windows you use frequently in the same position every time you open them (or let your window manager do that for you). Say you're working on a project which requires you to use a MySQL command prompt, and the project takes several days. When opening the window for the first time, remember its location and place it at that position the next morning (if it's not still there). Then, whenever you want to issue an SQL statement, you'll know: ah: top right, that's where it was.
Similarly, if you work in a terminal program with tabs, use the n_th tab for the task, and always the n_th tab. For example, I have my e-mail program in the second tab of my iTerm. Always.
Use colors on your shell windows to give them a meaning. For example, if you're root on a very important machine, give that terminal a red background as a warning signal. That way, whenever you switch to that you are reminded to be careful.
Keep your fingers off the cursor keys, and learn how to use your shell
Back in the old days, before the advent of shells with history or readline, we
had to learn how to type. Today, I see people enter a short command (
then, half an hour later, instead of typing exactly those two characters (and
Enter), they spend dozens of seconds flicking the cursor-up key in search of
ls in their shell's history!
Let's say you use bash. Why not learn how to use it? In Emacs mode, hit CTL-R
^R) and enter a few characters of the command you're looking for. In vi
mode, type ESC-/ enter a string and hit enter.
One I use a lot is an alias I call
r (for repeat). It's aliased to
-, so I can do what an exclamation mark does in many shells, and that is
comm repeat the last command which started with those letters. (I dislike the
! which is why I alias it to
Use scripts, Makefiles, or even aliases
You're building a small utility, and you have to test it. 1017 times probably.
Suppose the test consists of running
mycoolprog -l -i /etc/something -o
/tmp/out.me. You know the drill: edit, run, edit, run, etc. ad nauseam.
$ alias e='vi mycoolprog' $ alias g='mycoolprog -l -i /etc/something -o /tmp/out.me' $ e $ g $ e $ g
When you log out, the aliases are gone -- no cleanup required.
There are dozens, if not hundreds of ways you can save time. Do it.
End of rant.