next up previous contents
Next: 1.7 A Few Words Up: 1. Basic Linux Commands Previous: 1.5.4 1.5.4 Connecting with   Contents

1.6 bash Environment

Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh and csh). Bash is the default shell for most Linux distributions. Generally speaking a shell is a user interface to the Linux operating system. It takes input from the user and interprets those command into instructions that the operating system can understand.

Bash is a character based interface. It takes it's instructions from standard input in textual form, and usually produces character based output.

The shell's job then is to interpret user input into commands understood by Linux. It breaks up the lines of the command into pieces, called words. It then interprets these words, according to rules. The shell sets up I/O according to the instructions in the commands. It finds the commands in the files and runs them with options given on the command line.

Each step is made of one or more substeps, each containing a particular instruction to the underlying operating system. The shell itself is not Linux, just the user interface to it. Unix is one of the first operating systems to make the user inerface independant of the operating system.

The shell can do more than just pass commands to the system for execution. The shell helps you use the computer. The shell is a command interpreter that can expand and change the commands according to built in rules. Of equal importance are wild-card and command connection operators that make the command line more general and flexible. The shell can take advantage of conditions in the environment, managed by the shell, to customise the way commands work.

Bash's command-line editing is one of the most powerful features. It's very easy to correct mistakes and modify previous commands to save time and keystrokes. Another major feature of bash is it's job control. Job control allows you to stop, start and pause any number of commands at the same time. You may wish to modify the characteristics of your environment, for this there are shell variables. A shell variable is a name with an associated value. Bash keeps track of several built-in variables. The convention is for shell variables to have names in all capital

letters. Bash-specific built-ins are, however defined in lowercase. The environmental variable will always be know by the subprocesses, however the shell needs to be told about other variables, options, aliases, etc., that are to be communicated to subprocesses. The way to do this is to declare them in the environment file. On Linux systems this is commonly the .bashrc file in the users home directory.

USERNAME
 
System login name.

EDITOR
 
Pathname to your text editor

HISTFILE
 
The name of the file, where the bash history is kept. Typically this is set to /.bash_history.

HISTSIZE
 
The size of the history file. How much history is saved.

MAIL
 
Name of the file to check for incoming mail

HOME
 
Name of your home (login) directory

HOSTNAME
 
The system hostname.

LANG
 
The Language environment. What language are you using?

LD_LIBRARY_PATH
 
Where the shell is to look for shared libraries.

OLDPWD
 
Previous directory before the last cd command

PWD
 
Current directory

TERM
 
Type of terminal you are using. The variable TERM is vitaly important for using any screen editor and for third-party applications. The value of TERM must be a short character string with lowercase that appears as a filename in the terminfo database. The terminfo databse describes how to tell terminals to do certain commaon things like position the cursor on the screen, go into reverse video, scroll, insert text, and so on.

PATH
 
The command search path. The directories and search order should check for

SHELL
 
Path to the shell command.

PS1
 
The primary prompt string. The default value on Red Hat Linux is ``\u@\h \$''. Here's a table of values you can use to customize you're prompt.

USER
 
The current user of the shell.

MANPATH
 
Path to the system man pages. Typical setting would be something like this:

joe@localhost $ echo $MANPATH

/usr/man:/usr/X11R6/man:/usr/lib/perl5/man:/usr/share/perl5/man/
OTHERS
 


next up previous contents
Next: 1.7 A Few Words Up: 1. Basic Linux Commands Previous: 1.5.4 1.5.4 Connecting with   Contents