Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

Linux login and logout Files

Expert Oracle Database Tips by Donald BurlesonMarch 22, 2015

Login and Logout Files

At login or when switching users with su -, the shell executes a series of commands from files known as login files.  Some shells, ( bash included) , also execute commands at logout.  These files typically contain variable definitions that control the user environment, application behavior and command aliases, but they may also contain commands that perform cleanup routines and other tasks on the system.

Next to be covered in detail is the login behavior of the bash shell.  Different shells may use different file names, but the overall steps are the same.

Bash Shell Login Behavior

The first file to be read and executed is /etc/profile.  This is the system wide configuration file and is always read by a login shell if it exists.  The /etc/profile file is typically maintained by the system administrator and should only contain settings and defaults applicable to every user on the system.

Next, bash goes looking for one of the following files in the user's home directory:

  • .bash_profile
  • .bash_login
  • .profile

The bash shellreads and executes the first of these files that it finds, looking in the order listed above.  Once it has located and executed one of these startup files from the home directory, all others are ignored.

If none of these files are available, the user only has settings from the system wide /etc/profile file.  If bash goes looking for one of these files and it exists but is not readable, it reports the error.

Since these files begin with a period (.), they are hidden by default.  If they need to be viewed in a directory listing, use the -a option for the ls command. With these startup files, it is important to remember that only the first one found is read.  If, for instance, there are both a .bash_profile and a .profile in the home directory, the .bash_profile is read and executed and the .profile ignored.

When a user is created on the Linux system, several baseline files are created including .bash_profile and .bash_logout files.  These files are copied from the /etc/skel directory and provide a baseline for the login and logout files.  The copy of these files in a user's home directory can be edited to change the default behaviors.

Any of the login files may call other login files.  For example, the default .bash_profile has this entry to call the .bashrc file.  Here is a partial listing of the .bash_profile file:

# Get the aliases and functions

if [ -f ~/.bashrc ]; then
   . ~/.bashrc
fi

This section uses an if statement to determine if the file .bashrc exists in the user's home directory.  If it does, it is executed as part of the current session as indicated by the period before ~/.bashrc.  This allows parts of the login files with different functions to be separated out into different files.

 

 

 
 
 
Get the Complete Details on
Linux System Management for Oracle DBAs  


The landmark book "Linux for the Oracle DBA: The Definitive Reference" provides comprehensive yet specific knowledge on administering Oracle on Linux.   A must-have reference for every DBA running or planning to run Oracle on a Linux platform.

Buy it for 30% off directly from the publisher.
 


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster