Saturday, February 27, 2010

Unix Shells - Basics

Shell in unix acts as a command interpreter between user and Unix kernel as well as provides a strong scripting language .

Here are the different types of Unix shells -
B shell , /bin/sh – This is the default Unix shell for many Unix operating systems .
Bourne shell was written by S. R. Bourne and its more emphasis is to use it as a scripting language rather than an interactive shell .
Some of the features are :
Provided support for environment variables using parameters and exportable variables.
Redirection of program output and error .
Command substitution using back quotes: `command`.
embed a file/commands using input redirector <<
“for ~ do ~ done” loops
 "case ~ in ~ esac” for selecting and responding to a data value .

C-shell /bin/csh was designed to provide the interactive features lacking in b shell such as job control and aliasing .
K shell /bin/ksh – was created by David Korn and has features of both B shell and C shell along with some additional features .
Bash – the Bourne again shell was developed by GNU project .It is based on B shell language and has features of C and K shells.
tcsh is the default shell of FreeBSD and its descendants. Essentially it is C shell with programmable command line completion, command-line editing, and a few other features.
Zsh is a shell designed for interactive use and it has many of the useful features of bash, ksh, and tcsh along with many new features.

Unix Shell configuration files:
—————————————————–—————————————————–
b shell
shell prompt : $
executable file : /bin/sh
Read on interactive/non interactive login to bash
/etc/profile
~/.profile
—————————————————–—————————————————–
bash shell
shell prompt : $
executable file : /bin/bash
Read on interactive/non interactive login to bash
/etc/profile
~/.profile
~/.bash_profile
~/.bash_login

Always read on invoking bash
~/.bashrc
/etc/profile login login login
~/.profile login login

—————————————————–—————————————————–
csh shell
shell prompt : %
executable file : /bin/csh

Read on csh shell invocation .
/etc/csh.cshrc
~/.cshrc

Read on interactive/non interactive login to tcsh shell
/etc/.login
/.login
~/.logout
/etc/csh.login
ksh


—————————————————–—————————————————–
shell prompt : $
executable file : /bin/ksh
Read on interactive/non interactive login to bash
/etc/profile
~/.profile
tcsh shell


———————————————————————————————————–
shell prompt : &
executable file : /bin/tcsh

Read on tcsh shell invocation .
~/.tcshrc
/etc/csh.cshrc
~/.cshrc

Read on interactive/non interactive login to tcsh shell
/etc/.login
~/.login
~/.logout
/etc/csh.login
zsh


—————————————————–—————————————————–
shell prompt : $
executable file : zsh
Configuration files :

Always read on invoking zsh
~/.zshenv always
/etc/zshenv always

only read on interactive login to zsh.
~/.zshrc
/etc/zshrc

Read on interactive/non interactive login to zsh
/etc/zprofile login
/etc/zlogin login
/etc/zlogout login
/.zprofile login
~/.zlogin login
~/.zlogout login
—————————————————–—————————————————–

No comments:

Post a Comment