Friday, November 9, 2012

What is .profile file in Linux


.profile is file containing commands that is executed automatically every time user logs in to the system. it may contain any Linux command including some system parameter initialization, setting alias,     exporting some variables etc.

.profile is basically to set user environment in Linux, each user can have their own .profile file located at users /home directory, globally it is located as /etc/profile.To see .profile file you can go to "/home/username"  directory , type "ls -a" (to list all files including hidden file) and then cat .profile.

example of .profile:


PATH=$PATH:$HOME/bin:/usr/local/bin:/usr/ccs/bin:.
MAIL=/var/mail/$LOGNAME 
MANPATH=/usr/share/man:/usr/local/man 
PRINTER=printer1 
umask 022 
export PATH MAIL NNTPSERVER MANPATH PRINTER 
set -o vi
alias myw= cd /home/username/workdir/