Command Line 101 The Shell

Commands issued at the command line on any computer system are read and executed by a program known as a command interpreter. A command interpreter does the following:

■ Reads the commands and any options and arguments that you provide

■ Translates or expands any special characters such as the * and ? used as wildcard characters on Linux and Unix systems (more about these in the next section)

■ Locates the command that you want to execute on your system

■ Executes that command with the appropriate options and arguments and displays any output of that command

On Linux and Unix systems, a command interpreter is known as a shell. Linux and Unix systems offer many different shells, each of which has its own special features and devotees.

There are several shells included in the SUSE system, including ash, csh, ksh, tcsh, and zsh. They all have their advantages and disadvantages, and some users have strong preferences for one shell over another. However, bash has become the effective standard on Linux systems, and from now on all the examples in the book will assume that you are using the bash shell.

On Linux systems, the list of "legal" shells is maintained in the file /etc/shells. The contents of this text file list the possible shells that can be started when you log in on the system.

[email protected]:~> cat /etc/shells

/bin/ash

/bin/bash

/bin/bash1

/bin/csh

/bin/false

/bin/ksh

/bin/sh

/bin/tcsh

/bin/true

/bin/zsh

/usr/bin/csh

/usr/bin/ksh

/usr/bin/passwd

/usr/bin/bash

/usr/bin/tcsh

/usr/bin/zsh

Not all of these are "real" shells. If a user's shell is /bin/false, it means that user cannot log in; the passwd program is included here so that users can be forced to change a password at an appropriate time.

In addition to being able to execute standard Linux commands for you, each of these shells supports its own command language. Command files written in the command language provided by a shell are known as shell scripts. The first line of a shell script typically identifies the shell that should be used to run the command script. If no shell is identified in the first line, a shell script is executed by the sh shell, which is usually the same thing as the bash shell on Linux systems.

Was this article helpful?

0 0

Post a comment