Shell configuration
From Initq
Contents |
Files
When you turn your machine on the first thing that gets loaded is the bootloader, then the kernel starts the first process called init. itit always has the process id 1.
[root@initq etc]# ps -eaf | grep init root 1 0 0 Mar04 ? 00:00:14 init [5]
The init process reads a file called /etc/inittab. inittab runs all the rc scripts for the proper runlevel and then waits for the login. The login scripts all depend of the default shell. First login script taht is run is /etc/profile.
/etc/profile
- this file contains the environment variables and start up programs. This file is run at login time. this is a system wide initialization file. This file starts by setting up some helper functions and some basic parameters. It specifies some bash history parameters and, for security purposes, disables keeping a permanent history file for the root user. It also sets a default user prompt. It then calls small, single purpose scripts in the /etc/profile.d directory to provide most of the initialization. the /etc/profile also calls the /etc/profile.d directory and all the *.sh files in it. They contain individualized configurations for the system.
/etc/inputrc
- 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
/etc/profile.d
[alibaba@ohnonono profile.d]$ ls colorls.csh glib2.sh krb5-devel.sh lang.sh vim.sh colorls.sh gnome-ssh-askpass.csh krb5-workstation.csh less.csh which-2.sh cvs.sh gnome-ssh-askpass.sh krb5-workstation.sh less.sh glib2.csh krb5-devel.csh lang.csh vim.csh
/etc/bashrc
- this file contains shell aliases and functions.
~/.bash_profile
- If you want each new user to have this file automatically, just change the output of the command to /etc/skel/.bash_profile and check the permissions after the command is run. You can then copy /etc/skel/.bash_profile to the home directories of already existing users, including root, and set the owner and group appropriately.
~/.bashrc
- The comments and instructions for using /etc/skel for .bash_profile above also apply here. Only the target file names are different.
[alibaba@ohnonono skel]$ pwd /etc/skel [alibaba@ohnonono skel]$ ls -la total 48 drwxr-xr-x 2 root root 4096 Dec 2 03:21 . drwxr-xr-x 95 root root 12288 May 25 04:02 .. -rw-r--r-- 1 root root 24 Jul 12 2006 .bash_logout -rw-r--r-- 1 root root 176 Jul 12 2006 .bash_profile -rw-r--r-- 1 root root 124 Jul 12 2006 .bashrc
~/.bash_logout
[alibaba@ohnonono skel]$ cat .bash_logout # ~/.bash_logout clear
The sequence of files is this : /etc/profile --> /etc/profile.d --> /etc/bashrc --> ~/.bash_profile --> ~/.bashrc --> ~/.bash_logout.
