Computing in the real world
SEARCH FOR: IN:
Guest  Level 00    Register Log in

Real World Computing

The indispensibles

13th April 2007 [PC Pro]

Screen has been around for many years, and those who've used it tend to be hooked within minutes. Basically, it allows you to connect to a server once and then run multiple "virtual terminals" on that server. Launch it with the command screen and you'll be presented with your usual shell prompt. Hit then C and a new virtual screen is created, so you have another shell prompt from which you can run programs or do whatever you need - you can keep creating as many virtual screens as you need and do different things in each of them. The neat part is that if you get disconnected from the system - as happens to Ian, for example, if his connection stays inactive for more than five minutes (yet another Draconian firewall rule) - then Screen and all its virtual screens will keep on running, so that once you reconnect to the remote system you simply type screen -r and you're back exactly as you were before. (The "r" stands for "reattach".)

Most Linux/Unix versions and, indeed, Mac OS X come with Screen as a standard part of the distribution and, if not, see the "Where to get them" box at the end of this column for information on where you can download this essential utility.

MultiTail

The tail command is probably familiar to anyone with more than a passing acquaintance with any flavour of Unix. In its simplest form, it just displays the last ten lines of any file, but flags added to the command can allow you to do many other things, such as to "follow" a file - that's to say, tail -f will display the last ten lines and keep displaying any new lines appended to the file. This is extremely useful when you're debugging software, for instance - while developing a website, we'll run tail -f on its error log to display any errors as they're generated.

The problem is that you'll often want to tail multiple files simultaneously, such as the main web server error log, the access log and a custom log file that your own application writes into. Enter MultiTail, described by its author Folkert van Heusden as "tail on steroids". MultiTail allows you to tail multiple files on the screen at the same time by splitting the screen either horizontally, vertically or both. It can also colour the output from many common file formats, such as the syslog file, and you can supply a regular expression so any lines that match that regex will be displayed in colour, allowing you to quickly pick out important information. It also allows you to filter lines, so only matching ones are displayed and much, much more. One neat feature is that after you have a few files open in its window, you can make MultiTail generate the command that will invoke it on that set of files, so you can interactively set it up to your own preferences and then generate a single command, which will duplicate that setup in the future.

Although it's a fairly specialised tool, MultiTail makes our lives so much easier when developing websites, or even when simply performing system administration tasks on our servers. MultiTail is included in some Linux distributions by default, but otherwise you can download either the source code or packages for most major Linux distributions.

ImageMagick

Although ImageMagick isn't something we use every day, it's the first tool we reach for when we need to manipulate images in any way. It can be used as a command-line tool or be invoked from within another program. Those of you who use Photoshop - or, indeed, The GIMP, the open-source graphical image-manipulation program - may be wondering how on earth you can use an image-manipulation program from the command line. Well, it turns out that often the command line is by far the quickest way to perform basic tasks such as converting image files from one format to another, resizing them or adding some identical "watermark" text - a copyright message or whatever - to each one.

Continued....