Files

Friday, January 28, 2011

.bash_profile, .bashrc, .bash_logout

.bash_profile is a bash script file which is run when the system starts up. Each user has their own .bash_profile, .bashrc and .bash_logout file. For the root user it is in /root/ and for other users it is in /home/username/ directory.
User specific environment and startup programs are written in .bash_profile file.

# .bash_profile

# Get the aliases and functions
# If file ~/.bashrc exists then run the file

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

# User specific environment and startup programs
# Additional path can be added seperated by colon eg. PATH=$PATH:$HOME/bin:/usr/sbin:/sbin

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

User specific aliases and functions are declared in .bashrc



# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
# If file /etc/bashrc exists then run it
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi



The scripts which needs to be run when the user logs out can be written in .bash_logout.


# ~/.bash_logout

clear

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home