Difference between .bashrc and .bash_profile when you loginto unix system with default bash shell

posted May 4, 2013, 8:52 AM by Sachchida Ojha

This is also called a login or non-login shell

When you login (eg: type username and password) via console, either physically sitting at the machine when booting, or remotely via ssh: .bash_profile is executed to configure things before the initial command prompt.

But, if you've already logged into your machine and open a new terminal window (xterm) inside Gnome or KDE, then .bashrc is executed before the window command prompt. .bashrc is also run when you start a new bash instance by typing /bin/bash in a terminal.

alias script='cd /home/sachi/scripts'
alias download='cd /home/sachi/Downloads'

## pass options to free ## 
alias meminfo='free -m -l -t'

## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'

## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'

## Get server cpu info ##
alias cpuinfo='lscpu'

## older system use /proc/cpuinfo ##
##alias cpuinfo='less /proc/cpuinfo' ##

## get GPU ram on desktop / laptop## 
alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log'

alias df='df -H'
alias du='du -ch'

# top is atop, just like vi is vim
alias top='atop'

alias update='yum update'
alias updatey='yum -y update'

alias iptlist='/sbin/iptables -L -n -v --line-numbers'
alias iptlistin='/sbin/iptables -L INPUT -n -v --line-numbers'
alias iptlistout='/sbin/iptables -L OUTPUT -n -v --line-numbers'
alias iptlistfw='/sbin/iptables -L FORWARD -n -v --line-numbers'
alias firewall=iptlist

# show open ports

alias ports='netstat -tulanp'

alias path='echo -e ${PATH//:/\\n}'
alias now='date +"%T'
alias nowtime=now
alias nowdate='date +"%d-%m-%Y"'

alias h='history'
alias j='jobs -l'
alias mount='mount |column -t'

alias mkdir='mkdir -pv'

# start a calculator

alias bc='bc -l'

alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'

## get rid of command not found ##
alias cd..='cd ..'

## a quick way to get out of current directory ##
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'

## Colorize the ls output ##
alias ls='ls --color=auto'

## Use a long listing format ##
alias ll='ls -la'

## Show hidden files ##
alias l.='ls -d .* --color=auto'

Comments