Three Utils Every Unix Person Should Know
There are three applications that come preinstalled with most *nix distros that if you spend any time whatsoever at a bash prompt make life vastly easier.
- vi/vim - IMHO everyone should at least have basic familiarity with vi. It's damn near always available, works like a charm, and once you are familiar with it allows you to do amazing things, quickly and without reaching for a mouse.
- ssh - Not much to say about this one. Very basic on the totem poll, right below "cp" or "ls" on the "yeah you should know these" scale.
- GNU screen - This one not as many people seem to be familiar with, but also makes life much more tolerable. Think of it as a way to introduce tabbed browsing into your terminal, all without needing a mouse. To create a new "tab" just hit Ctrl-A, c. To go to the next "tab", hit Ctrl-A, n. Now, there are plenty of terminal programs out there that have implemented tabs, but screen is higher on my list for several reasons. First, I don't have to use the mouse. Second, you can copy/paste text between tabs using only your keyboard. Third -- and probably the coolest -- you can detach from a screen session and reattach from a different machine, and maintain everything.
Let me explain.
Let's say you have a screen session running on your machine at work, and have 3 sessions open: one has vim open with some code you're working on, another is tailing the logs of your webserver, and another is you're general purpose bash session. So you go home, and in a flash of inspiration realize what you need to do to fix that code. So you ssh in to your work machine and type in "screen -d -r". This detaches the already running screen process and gives all those sessions to you. Voila. You have your editor, your webserver logs, and your bash shell exactly as they were when you went home.
If you decide to give screen a try, drop this in your ~/.screenrc. It puts a nice, shiny toolbar at the bottom of your window that lists the title of each session.
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "