Thursday, March 12, 2009

Setup basic environment profile on Unix/Linux Systems

Step 1 : First thing first: make sure your account has default shell.

cat /etc/passwd
*Note: Your default shell is at the end of your id.

format of /etc/passwd file: Username
:Password:User ID (UID):Group ID (GID):User ID Info:Home directory:default shell

If shell is not the default id, then ask your SA to change it to the needed one. Usually bash is default.

Step 2 : Go to your home directory or just type cd; which takes you to your home directory.

Step 3: Create a .bashrc file (vi .bashrc) and insert the following content onto it and save it (:wq)
#-------------------------------------------------------------
PATH=usr/local/bin:/usr/lib:/usr/bin:; export PATH

EDITOR=vi; export EDITOR

stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs
TERM=vt100; export TERM
umask 022
stty istrip

set histfile=/.sh_history
set history=200
set filec

alias ll="ls -lart"
#------------------------------------------------------------------------------------

Step 4: Create a .bash_profile file (vi .bash_profile) and insert the following content onto it and save it(:wq)
#------------------------------------------------------------------------------------
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#------------------------------------------------------------------------------------

.bash_profile executes .bashrc everytime user logs into the system.

Step 5: Now try to reconnect to that box, you'll have your basic environment profile set.