Cracking Open the Shell

Another unusual feature of UNIX systems, especially for those of you who come from either the Macintosh or the Windows environments, is that UNIX is designed to be a command-line-based system rather than a more graphically based (picture-oriented) system. That's a mixed blessing. It makes UNIX harder to learn, but the system is considerably more powerful than fiddling with a mouse to drag little pictures about on the screen. In UNIX parlance, a command-line interpreter is called a shell, and you'll see that various shells are available, differing in both syntax and capabilities.

There are graphical interfaces to UNIX, built within the X Window System environment. Notable ones are Motif, OpenWindows, and Open Desktop. Even with the best of these, however, the command-line heart of UNIX still shines through, and in my experience, it's impossible really to use all the power that UNIX offers without turning to a shell.

If you're used to writing letters to your friends and family or even mere shopping lists, you won't have any problem with a command-line interface: it's a command program that you tell what to do. When you type specific instructions and press the Return key, the computer leaps into action and immediately performs whatever command you've specified.

Throughout this book, I refer to pressing the Return key, but your keyboard may have this key labeled as “Enter” or marked with a left-pointing, specially shaped arrow. These all mean the same thing.


In Windows, you might move a file from one folder to another by opening the folder, opening the destination folder, fiddling around for a while to be sure that you can see both of them on the screen at the same time, and then clicking and dragging the specific file from one place to the other. In UNIX it's much easier: Typing the following simple command does the trick:

cp folder1/file folder2

It automatically ensures the file has the same name in the destination directory too.

This might not seem much of a boon, but imagine the situation where you want to move all files with names that start with the word project or end with the suffix c (C program files). This could be quite tricky and could take a lot of patience with a graphical interface. UNIX, however, makes it easy:

cp project* *.c folder2

Soon you not only will understand this command, but also will be able to compose your own examples!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset