How do I set user profile under bash shell running Ubuntu Linux operating systems?
You need to edit the following files to set profile for users.
Systemwide Profile For All Users
/etc/profile: You need to update /etc/profile which is systemwide initialization profile file. All changes made to this file applies to all users on the system.
/etc/bash.bashrc : The systemwide per-interactive-shell startup file. This file is called from /etc/profile. Edit this file and set settings such as JAVA PATH, CLASSPATH and so on.
How Do I Edit Systemwide Profile Files?
Use the text editor such as vi:
sudo vi /etc/profile
Profile For Individual Users
Use the following shell startup files to customize each user profile. The following files are located in users $HOME directory such as /home/vivek.
- $HOME/.bash_profile - The personal initialization file, executed for login shells. Add PATH settings and other user specific variables to this file.
- $HOME/.bashrc - The individual per-interactive-shell startup file. Add user specific aliases and functions to this file.
- $HOME/.bash_logout - The individual login shell cleanup file, executed when a login shell exits.
You can edit above files with the following command:
vi ~/.bashrc
vi $HOME/.bash_profile
Sample $HOME/.bash_profile
# shell path export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server export ORACLE_SID=XE export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh` export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin export EDITOR=vim export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre # load ssg keys /usr/bin/keychain $HOME/.ssh/id_dsa source $HOME/.keychain/$HOSTNAME-sh # turn on directory spelling typos shopt -s cdspell
Sample $HOME/.bashrc
# shell functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias vi='vim'
alias grep='grep --color'
alias update='sudo apt-get update && sudo apt-get upgrade'
alias dnstop='dnstop -l 5 eth1'
alias vnstat='vnstat -i eth1'
alias bc='bc -l'
genpasswd() {
local l=$1
[ "$l" == "" ] && l=16
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
mp3(){
local o=$IFS
IFS=$(echo -en "\n\b")
/usr/bin/beep-media-player "$(cat $@)" &
IFS=o
}Recommended readings:
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop






![Linux: Change the PATH [ Add New Directory ]](http://s13.cyberciti.org/images/shared/rp/3/4.jpg)








{ 1 comment… read it below or add one }
Very helpful info – would like to receive more – Thanks