Wednesday, October 7, 2015

login shell vs interactive shell




System Wide settings  

              A shell is a shell is a shell -- e.g., a login bash shell is the same program (like /bin/bash) as a nonlogin bash shell. The difference is in the way that the shell acts:


            In a Login shell you are prompt for your Login username and password

           when you first log in to a Unix system from a terminal, the system normally starts a login shell. The login shell uses a collection of startup files to help create an environment such as environment variables, search path, and subshells.

           The files in the /etc directory generally provide global settings. If an equivalent file exists in your home directory it may override the global settings.


Login shell process:

Frist the bash login shell looks for the global settings.

It first initiates the  

/etc/profile.

The /etc/profile file provides the system wide default environment variables. Typically this sets up the umask, LOGNAME, and mail directories etc. It can also be used to change the default command search path (PATH) for all users on the system.

The /etc/profile.d Directory 

This file is actually a line in the /etc/profile. It loads are the file in the  /etc/profile.d directory, where the individual initialization scripts are placed: 

/etc/profile.d/* 

Any thing you need to modify,you don’t want to create in /etc/profile,you can create it in .sh and put it in the /etc/profile.d/ director.


So if a system updates occurred all the changes you have written in the /etc/profile got changes .but if you place files in the /etc/profile.d nothing happens to your executable  files.


/etc/bash.bashrc 

It contains the System wide aliases and functions.Personal aliases and functions should go into ~/.bashrc.it Provides colored /bin/ls and /bin/grep commands.Used in conjunction with code in /etc/profile.

These three complete the system wide settings

User wide settings

IT looks for three profile

/home/user/.bash_profile
/home/user/.bash.login
/home/user /profile

/home/user/.bashrc

This file is where you put your history length,Xterm color and alias
 
   


Here you can see ll commands returns ls –aLF

Where do I get all these ?
It all there in the /etc/skel

.bash_logout
What it does when the login shell exits it clears the console history

 Interactive shell is when you are already logged in GUI mode and open a terminal, and then you can tell that it is an interactive shell
 



No comments:

Post a Comment