Penguin
Note: You are viewing an old revision of this page. View the current version.
"Linux supports the notion of a command line or a shell for the same reason that only children read books with only pictures in them.
Language, be it English or something else, is the only tool flexible enough to accomplish a sufficiently broad range of tasks."
-- Bill Garrett

A CommandLine is a program interface which the user interacts with by entering commands as written text. The program then parses these commands and acts accordingly. Such an interface is usually highly scriptable - even if not intentionally so, but by virtue of redirection. When it is designed with scripting in mind, it is usually particularly powerful.

In Unix, nearly all tasks can and should be done on the CommandLine. Most people think of this as a pain, but there are many features to make working on the CommandLine more convenient and therefor efficient. Unix Shells are lightyears ahead in terms of usability compared to the CommandLine interpreters MicrosoftCorporation has delivered with their OperatingSystems in the past, although some of the more basic (and vital) conveniences such as TabCompletion have finally found their way into Microsoft CommandLine interpreters. (You're 30 years late, guys, but hey, welcome to the party anyway.)

Do also note that a Unix system typically exposes its entire innards via means that are easily accessible from the Shell - much unlike any flavour of MicrosoftWindows.

As well, there is a large variety of small reusable tools to take care of common tasks (see TwoLetterCommands for a non-exhaustive list); taken together, these provide the means to write any program as a shell script, should you be so inclined. Doing so may not be not advisable for non-trivial tasks - the Shell's syntax lacks sufficiently powerful constructs to express complex algorithms succintly. However, it is possible.

In fact, just about anything you do manually, possibly using a GUI application, can be done automatically with some counterpart for the CommandLine. (Web related tasks can be automated using wget(1), curl(1), w3m(1)?, or others, to name an example.)

Of course, all this power comes at a price: to the unitiated, the CommandLine is arcane and scary. One way to address that is providing sources of information. This wiki is one of them; but you can get help right on the CommandLine using apropos(1) and man(1) as well. Be prepared to do lots of reading (and selective ignoring) at first: Unix commands often have dozens of options that are rarely used. The man(1) command itself has 24 options, yet you will almost never use any of them. Don't memorize them - just pick the parts you need and come back to the manpage again if you're missing something. This way you will acquire the common basics soon enough.

An example for the CommandLine's power is when you have a large set of files, which you want to selectively perform some action on (eg rename/move/delete some of them). You can use find(1) for this. (There are more ways, but find(1) is by far the most common.) This is a far cry from the Find Files dialog in MicrosoftWindows, with which you can only select files based on a partial match of their name without resorting to inspecting the files' contents (and even then the options are limited). The resulting is just about useless for any other action than mass deletion, mass opening of files, or moving them all into a single directory. More complex actions, like directory structure preserving moves, simple rule based renaming, or anything else, is not supported by that interface - you have to do the work manually.

This is a perfect example, actually: GUIs can only be used to communicate intentions that their designer had already thought of. It has been said that GUIs are much like picture books; and there's a reason people stop using those back in grade one. To express non-trivial concepts or intents you need an actual lingual interface. And that is what the CommandLine is.