Shell Programs - Linux


Unix allows each individual user to select a customizable command line interpretor. The standard Unix shell, called the Bourne shell after its author, is called sh and it resides in the /usr/bin directory.

The shell is a program that, like any other program, can be replaced. The shell is a command interpreter and a command programming language. It prompts for, reads and executes commands. The commands can come directly from a terminal or from a file.

csh /ksh

All Unix operating systems have the standard Unix shell sh. Two alternative shells csh (sea shell) and ksh are available and widely used. "csh" was developed by the University of California at Berkley. "ksh" was developed by AT&T and the "k" stands for Korn for the developer David Korn. Linux uses a shell called bash for Bourne again shell. It has added refinements from both csh/ksh shells.

Features of the "csh"

  • Uses .cshrc and .login files for initialization at startup. These files are used for configuring your environment.
  • Has a configuration file called .logout that is read when you end your session.
  • Has a command history list.
  • Allows job control as discussed earlier.
  • Provides directory management. Additional directory commands: cd, dirs, pushd, popd. (Some csh versions don't provide this feature)
  • Offers a more C-like syntax than "sh".
  • When enabled by "filec", csh can complete partially typed unambiguous names for you.
  • A list of aliases is kept for you (in .cshrc) that contain frequently used or complicated commands.

The Korn shell ksh uses the best features of the csh with the following enhancements:

ksh enhancements:

  • Command-line editing using editors from hell worse than DOS's edlin. (Don't know where this came from - it's been many years since I wrote this ;-)
  • Improved cd (change directory) command.
  • Improved shell programming.
  • Allows pathname to appear in the prompt similar to DOS.

The ksh uses the .profile file for startup configuration.

Aliases

Depending on the shell that you are using, you will have a startup file called either .cshrc (csh) or .profile (ksh). These files contain startup information for the user. Each user has a startup file in their home directory which can be modified to suit their individual needs.

Aliases are a means of individualizing a user's account. The user can use aliases as a macro to shorten command-line entries. In the startup file, there is an area with the heading "# handy alias". The "#" indicates that this is a comment and is ignored by the operating system. Following this heading is a list of aliases:

 alias vt100="set term = vt100"

This line substitutes "set term = vt100" for when you type "vt100" at the command-line. "set term = vt100" is how you tell the Unix system what type of terminal you are emulating. Depending on the flavour of Unix that you are running, you may or may not need the "=" sign after "vt100".

Notice: There is an alias for "help", it is the Unix command "man" (manual).

If this page has helped you, please consider donating $1.00 to support the cost of hosting this site, thanks.

Return to

TelecomWorld 101

Copyright July 2013 Eugene Blanchard