TECH SOLUTION

TECH SOLUTION

Saturday, 19 October 2013

SYSTEM WIDE SHELL CONFIGURATION SCRIPTS



System wide Shell Configuration Scripts :

1.     These files determine the default environment settings of system shells and what functions are started every time a user launches a new shell.

2.     These all files or scripts are located in /etc and affect all shells used on the system.

3.     An individual user can also set up a default configuration file in their home directory that affects only their shells.

4.     This ability is useful in case the user wants to add some extra directories to their path, or some aliases that only they use.

5.     When we use this files in the home directory, the names of files remain  same, except they have ‘.’ in front of them. So /etc/bashrc affects bash shells systemwide, but /home/User/.bashrc effects only the shells of mentioned user.



Some of the Configuration Scripts are as follows

·        SHELL CONFIG SCRIPTS: BASHRC, CSH.CSHRC, ZSHRC

1.     Bashrc is read by bash, csh.cshrc is read by tcsh, and zshrc is read by zsh.

2.     These files are read every time a shell is launched, not just upon login, and they determine the settings and behaviors of the shells on the system.

3.     These are places to put functions and aliases.

Note :  tcsh is a Unix shell based on and compatible with the C shell (csh). It is essentially the C shell with programmable command line completion, command-line editing, and a few other features.

The Z shell (zsh) is a 
Unix shell that can be used as an interactive login shell and as a powerful command interpreter for shell scripting.

·        PROFILE

1.     This file is read by all shells except tcsh and csh upon login. Bash falls back to reading it if there is no bash_profile.

2.     Profile is a good place to set paths because it is where you set environmental variables that are passed on to  child processes in the shell.

3.     More default paths than are necessary can pose a security risk.



BASH, TCSH, ZSH AND THEIR CONFIG FILE READ ORDERS

Script Name
Read upon Startup
Read upon Log-out
BASH

1.     /etc/profile
2.     ~/.bash_profile
3.     ~/.bash_login
4.     ~/.profile.


1. ~/.bash_logout
TCSH

1.     /etc/csh.cshrc
2.     /etc/csh.login

Config File in user Home Directory

1.     ~/.tcshrc Or ~/.cshrc
2.     ~/.history
3.     ~/.login
4.     ~/.cshdirs


None

ZSH

1.     /etc/zshenv
2.     ~/.zshenv,
3.     /etc/zprofile
4.     ~/.zprofile
5.     /etc/zshrc
6.     ~/.zshrc
7.     /etc/zlogin.

Non Login Shell
1.     ~/.bashrc


1.     ~/.zlogout
2.     /etc zlogout


No comments:

Post a Comment