Читать книгу Linux Bible - Christopher Negus - Страница 18

Part II
Becoming a Linux Power User
Chapter 3
Using the Shell
Choosing Your Shell

Оглавление

In most Linux systems, your default shell is the bash shell. To find out what your default login shell is, type the following commands:


The who am i command shows your username, and the grep command (replacing chris with your name) shows the definition of your user account in the /etc/password file. The last field in that entry shows that the bash shell (/bin/bash) is your default shell (the one that starts up when you log in or open a Terminal window).

It's possible, although not likely, that you might have a different default shell set. To try a different shell, simply type the name of that shell (examples include ksh, tcsh, csh, sh, dash, and others, assuming they are installed). You can try a few commands in that shell and type exit when you are finished to return to the bash shell.

You might choose to use different shells for the following reasons:

● You are used to using UNIX System V systems (often ksh by default) or Sun Microsystems and other Berkeley UNIX-based distributions (frequently csh by default), and you are more comfortable using default shells from those environments.

● You want to run shell scripts that were created for a particular shell environment, and you need to run the shell for which they were made so you can test or use those scripts from your current shell.

● You simply prefer features in one shell over those in another. For example, a member of my Linux Users Group prefers ksh over bash because he doesn't like the way aliases are used with bash.

Although most Linux users have a preference for one shell or another, when you know how to use one shell, you can quickly learn any of the others by occasionally referring to the shell's man page (for example, type man bash). The man pages (described later in the “Getting Information about Commands” section) provide documentation for commands, file formats, and other components in Linux. Most people use bash just because they don't have a particular reason for using a different shell. The rest of this section describes the bash shell.

Bash includes features originally developed for sh and ksh shells in early UNIX systems, as well as some csh features. Expect bash to be the default login shell in most Linux systems you are using, with the exception of some specialized Linux systems (such as some that run on embedded devices) that may require a smaller shell that needs less memory and requires fewer features. Most of the examples in this chapter are based on the bash shell.

TIP

The bash shell is worth knowing not only because it is the default in most installations, but because it is the one you will use with most Linux certification exams.

Linux Bible

Подняться наверх