logo
Linux User
OpenSource Apache Embedded C Linux MySQL No deposit no GamStop bonuses Perl PHP Samba

Module Release December 2001: Work Effectively on the Unix Command Line

Until comparatively recently, the black propagandists for proprietary software were still trying to deter would-be escapees by perpetuating the fiction that Linux, and Unix in general, was a command line only operating system. The propaganda was so successful that many who finally made it over the wall were rather surprised to find an infinitely more powerful windowing architecture (X) and a range of ground-breaking desktops waiting for them on the other side.

Like the newly liberated citizens of Eastern Europe, however, some new Linux users have been so bedazzled by the absence of accustomed constraint that they have yet to discover the positive freedoms and powers which their new environment confers upon them.

A command line interpreter (invariably referred to as a "shell" in Unix-speak) is, arguably, among the most powerful means a user has for bending the computer to their will. If that interpreter is as feature-rich and easy to use as Bash (the default Linux shell), then that argument is practically redundant. There is barely a tool which combines the power, easy of use and ease of learning which you get with Bash.

Some readers will, no doubt, be raising a Roger Moore sized eye-brow at this point; thinking "OK, I can believe those old Unix gurus when they bang on about the power of the command line, but I am an ordinary mortal and I don't have 20 years to grapple with its black arts". This understandable reaction is, however, based on pretty-much the same combination of outdated and misleading information as the notion that Unix doesn't have a GUI.

Contrary to popular opinion, the Bash shell IS easy to use. Unlike some ancient Unix shells or their crippled cousin in the DOS box, Bash provides masses of user supports and shortcuts. Almost no experienced Bash user ever actually types an entire command line, nor do they have to remember obscure options and preferences. Typically, they will simply type 2 or 3 characters and let features like `filename completion' and `command history' automatically finish the job for them. This way, even navigating complex directory structures is quicker and easier on the wrists than clicking around Microsoft's Explorer.

Editing commands is as easy as using the simplest word processor and gives you a single point of access to almost every option and preference on your system. Using Bash can spell the end of tedious and time-consuming clicks through dozens of nested menus and dialogue boxes, just to find an option you rarely use.

Of course, sceptics will rightly say that using Bash is still impractical if it is too difficult and/or time-consuming to learn. Bash's most important features are, however, easy to learn. Almost all of it's most productivity enhancing features are easy to understand and can be acquired in a few days. Full mastery of shell PROGRAMMING can, however, take years. Perhaps the most important priority for any training programme is to separate these two areas of knowledge, so that the new user can access the immediate and significant benefits without the distraction of esoterica.

This month's module covers: the concept of shells; the distinctive features of Bash; navigating the filesystem; command line syntax; locating programs; setting shell variables; configuring Bash; using command history; command line editing; command completion and substitution; repeating commands with the for command; applying commands recursively using the find command.