Desktops and Shells

 < Day Day Up > 



If you followed the instructions in Chapter 2, “Installing Linux,” chances are that you are working from within the KDE desktop. If you are not in KDE, or are not sure, when you first boot up and go to the login screen, there are several words at the bottom, such as system. If you click on these you will see that they have menus. You can go to the system menu and select the desktop environment you want to use. If you followed the instructions in Chapter 2, you will have other desktop options, such as GNOME. You should select the KDE environment. Throughout most of this book, we will be working with the KDE environment.

Before we begin exploring desktops and shells, it would be prudent to get a firm grasp of exactly what a shell is and what a desktop environment is. A desktop environment is simply a graphical environment such as Windows. This means that your interaction with the computer is done via a graphical interface. You push buttons, click drop-down menus, and do most of your maneuvering with a mouse or a similar pointing device. It may not have ever occurred to you that there are other ways to interact with your computer. For most PC users, the graphical Windows interface is the only thing they have known since the early 1990s.

Even after the discovery of alternative means of interacting with a computer, most people prefer the graphical environment because it is more intuitive and user friendly. Early versions of Linux suffered from a lack of a graphical interface. Fortunately, that is no longer the case. In Linux you now have several desktop environments to choose from. We will delve into desktops later in this chapter, and much of this book will concern itself with using desktop environments and some of the applications you can run in the Linux desktop environment.

A shell is simply a command-line interface. A command-line interface is one in which you type commands, and the operating system types out responses. The interface is text only, usually a simple white font on a black or blue background. There are no user-friendly graphics, no buttons or drop-down menus. If you have ever used the DOS prompt in Windows 95 or 98 or the command prompt in Windows NT, 2000, or XP, then you have used a command-line interface. During the early years of computing, the command-line interface was the only way to work with any computer. In fact, Microsoft originally used a command-line interface–based operating system called Microsoft DOS® (disk operating system). Unix originally worked only via command-line interfaces as well. Apple was the first company to bring graphical desktop environments to the public, and Microsoft soon followed with Windows. Many people have become so accustomed to using a rich graphical environment that they are not even aware of command-line interfaces. You might think that such an interface is now outdated and of no use. While it is true that most users and even most administrators prefer the easy-to-use graphical interface, it is not true that the command-line interface has no use.

Now that you know what a shell is, you might wonder why anyone would ever choose to use one when there is a rich graphical desktop environment available. There are several reasons to use a command-line interface instead of a graphical user interface. One reason is that the command-line interface uses less of your computer’s resources. Since the command-line interface is not creating a graphical user interface, it does not require as much memory or processor power. Displaying all those colorful and easy-to-use graphical elements (such as buttons, toolbars, and drop-down menus) takes memory and processor speed. If you are working on an older machine that has limited resources, you may choose not to use a graphical user interface. With Linux, you can dispense with the graphical user interface altogether and use only the command line, if that’s what you want.

Another reason you might consider working with the command-line interface is that it is more streamlined. You can do anything with a command typed in directly. You do not need to go through a series of graphical steps such as selecting a drop-down menu, then a submenu, then choosing an option. You simply enter the appropriate command. A person who knows the proper commands can often accomplish a task faster in the command-line interface than via a graphical interface. It is also true that command-line interfaces, while less user friendly, are far more stable. In essence, they almost never crash or freeze up.

Linux has a command-line interface called a shell. It looks very similar to the DOS prompt or command prompt from Windows. However, Linux takes the command-line interface to a whole new level. With Windows you have a single command-line interface that has a limited repertoire of commands. With Linux you have several different shells you can use and a host of commands to work with. Each shell looks pretty much the same, and the vast majority of shell commands work in any shell. We will examine many of those commands in this book, and you should become increasingly familiar with them as you progress through this book.

However, there are interesting and useful features in each of the various shells that are unique to that shell. One useful feature that is common to all shells is that you can write scripts in them. A script is a short program that executes one or more tasks. In Windows you can write batch files for the DOS or command prompt, but there is a limited number of functions you can write into a batch file. The term batch file stems from the fact that it is a batch of commands being executed in sequence. Linux and Unix administrators write scripts to automate repetitive tasks. With a Linux script, you can write either a simple script, quite similar to a DOS batch file, or a fairly complex script that is essentially a program. These scripts have all the options that most programming languages do. We will be writing some scripts in a later chapter, in the final section of this book.

There are multiple shells you can use, each with specific advantages. One of the oldest is the Bourne shell. This was followed by an updated version called the Bourne-again shell (often simply called bash). The bash shell is the default used in Linux. There are other shells, each with its own advantages and disadvantages. The most commonly used shells are summarized in Table 3.1.

Table 3.1: Linux Shells

Shell

Features

Bourne

One of the oldest shells for Unix or Linux. It was created in the late 1970s by Steve Bourne and was included in the seventh edition of Bell Labs Unix.

Bourne-again (bash)

This is an updated version of the Bourne shell. It is the default shell used in most Linux distributions.

Korn

This shell was developed by David Korn at the AT&T Bell Labs. This shell is very popular with Linux administrators.

C

This shell is of particular interest to programmers. With it you can write and run programs written in the C language. You can write the code right in the shell and run it.

The list of shells in Table 3.1 is not exhaustive. These are the most commonly used shells, and any Linux enthusiast should at least be aware of their existence. In this book we will use the bash shell because it is the most commonly used Linux shell. Remember, however, that most of the basic commands and simple scripts work the same in all shells. It is only the more advanced techniques that are specific to certain shells. That means that what you learn about bash in this book can be applied to the other shells.

With Linux you have the option of having your machine start up in graphical mode or in shell mode. Even if you choose graphical mode, you can launch a shell, just as you can launch a command prompt in Windows 2000 and Windows XP. Once you have a shell open, you can then type commands as you want. If you followed the installation instructions in Chapter 2, your machine starts up in graphical mode. Let’s start by examining how you open a shell if your machine starts in graphical mode.

This chapter will mention the Windows command prompt several times and compare various Linux shell commands to the equivalent Windows command prompt commands. Many, but not all, Windows users have used command prompt commands. If you have never used a command prompt, it is found in Windows by clicking on the Start menu, choosing Programs, finding Accessories, and then clicking on the Command Prompt.

Assuming your machine starts up with a graphical interface, you will have to start your shell manually. Before you can start working with shell commands, you must first start up a shell. At the bottom-left corner of your screen you should see a Red Hat icon.

Note 

This assumes you are currently using the KDE interface. If you are not, then you should log out, and at the login screen change to the KDE desktop. It also is true that many distributions will put some other symbol here. In earlier versions of Red Hat you saw a K in this location.

Clicking on the Red Hat icon is much like clicking on the Start button at the bottom-left corner of Windows. When you click on the Red Hat icon, you are given access to a number of options. You can see the Windows Start menu and the KDE start menu in Figures 3.1 and 3.2.

click to expand
Figure 3.1: The KDE start screen.

click to expand
Figure 3.2: The Windows Start screen.

You can see that the menus are very similar. This should give you some level of comfort. The KDE interface is not that different from Windows, and you should be able to get comfortable with the KDE interface in a short time. We will go into more depth on how to maneuver in KDE later in this chapter. For now we just want to find the shell. Click once on the Red Hat icon and then move up the options until you see System Tools. If you let your mouse hover over this for a second or two, you will see suboptions that are part of the System Tools group. One of these options is labeled Terminal. By clicking on Terminal, you will launch a shell. It should look much like what you see in Figure 3.3.

click to expand
Figure 3.3: The shell.

As you can see, this looks a lot like a command prompt in Windows 2000 or Windows XP, or like a DOS prompt from Windows 95/98. This is to be expected, since a shell is basically a command-line interface. The next section will take you on a tour of some shell basics.



 < Day Day Up > 



Moving From Windows to Linux
Moving From Windows To Linux (Charles River Media Networking/Security)
ISBN: 1584502800
EAN: 2147483647
Year: 2004
Pages: 247
Authors: Chuck Easttom

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net