Environment Variables and Settings
There are many environment variables, some of which are listed below. The command used to add or modify environment variables is the export builtin command provided by the bash shell. See the bash(1) man page for more information on this built in command. PS1="[\u@h \w]\\$ " | | Used to set the command line string to output user,machine and name of directory the user is in. In Redhat, to effectively change this value, it must be changed in the file "/etc/bashrc" and in "/etc/profile". |
export PATH=$PATH:/usr/sbin | | Adds /usr/sbin to the path in the system environment |
MANPATH | | Sets the path for man pages |
- USERNAME
- HOSTNAME
- LOGNAME
- EDITOR - Specifies the editor to be used by default for some commands such as edquota. Usually it is set to vi or emacs with a command like "export EDITOR=emacs".
- TERM - The type of terminal being used.
- PATH - The path the system looks in to find commands that the user has entered.
- HOME - The current user's home directory
- SHELL - The current shell program that is being executed
- USER - The name of the current user.
- TMPDIR - Allows programs that use the tempnam(3) function call to use the directory specified by this variable rather than the /tmp directory.
- SHLVL - Shows how many shells the user has invoked.
SHLVL indicates how many shells deep the user is. If the level is 2, you must type "exit", then logout to exit.
Setting noclobber=1 - keeps files from being clobbered by the shell.
Shell Selection for users
The file "/etc/shells" lists the valid shells and shell paths on your system. An example file is:/bin/bash
/bin/sh
/bin/tcsh
/bin/csh
/bin/ash
/bin/bsh
/bin/bash2
/bin/ksh
/bin/zsh
The command "chsh" can be used by the user to set his preferred shell. Also the root user can use this command to set any user's shell. This command with the -l option will list the available shells. The -s option will allow the user to change their shell. For example type the following to determine and modify the user's shell.- chsh -l
- chsh -s /bin/sh
Startup Scripts
The following scripts are run by bash if the –noprofile option is not used with the shell: /etc/profile | | This script file is run first for all users during the login process |
$HOME/.bash_profile | | This script file is run for individual user's customized setup |
$HOME/.bash_login | | If the .bash_profile above does not exist, this file is run |
$HOME/.profile | | This script file is run if $HOME/.bash_profile and .bash_login don't exist |
The man page says that "$HOME/.bashrc" is run for non-login interactive shells. I'm not sure if it also runs for login interactive shells, but believe it does. If it does, I'm not sure whether it is run after the scripts above, but believe it is.
$HOME/.bash_logout | | Run when the user logs off the system. |
Key bindings:
If the shell variable "INPUTRC" is set, probably in "/etc/profile" the keybindings are set by the file declared in the INPUTRC value. Usually this is "/etc/inputrc". Otherwise the keybindings are set in the file "$HOME/.inputrc" for each individual user.
$HOME/.inputrc - User's keybindings definition
/etc/inputrc - Global keybindings definition
Other scripts and files:
/etc/bashrc | | On my Redhat system, this file is run by $HOME/.bashrc. |
/etc/login.defs | | Used with shadow passwords to set initial PATH and other parameters including how often a user must change passwords and what is acceptable as a password.. |
Therefore to modify parameters for all users, edit:
/etc/profile | | For users environment setup and other customized items. |
/etc/inputrc | | For keybindings on some systems if INPUTRC is set to it. |
HOME/.bash_profile - Users environment stuff and startup programs
$HOME/.bashrc - user aliases and functions
$HOME/.bash_logout - User actions to be done at logout
$HOME/.inputrc - Contains keybindings and other bits.
The tcsh shell operates as follows:$HOME/.bashrc - user aliases and functions
$HOME/.bash_logout - User actions to be done at logout
$HOME/.inputrc - Contains keybindings and other bits.
/etc/csh.login is run
$HOME/.tcshrc or .cshrc is run
$HOME/.login is run
Other files in the users home directory may be:$HOME/.tcshrc or .cshrc is run
$HOME/.login is run
.emacs - For the emacs editor. Consists of LISP functions.
.exrc - For the vi editor
.fvwmrc - For the fvwm window manager
.twmrc - For the twm window manager
.newsrc - For newsreaders. Contains a list of newsgroups offered at this site.
.Xdefaults - For programs using the X window system
.xinitrc - Shell commands that run when the user logs into an X session.
.exrc - For the vi editor
.fvwmrc - For the fvwm window manager
.twmrc - For the twm window manager
.newsrc - For newsreaders. Contains a list of newsgroups offered at this site.
.Xdefaults - For programs using the X window system
.xinitrc - Shell commands that run when the user logs into an X session.
0 comments:
Post a Comment