DEV Community

Janardhan Pulivarthi
Janardhan Pulivarthi

Posted on • Updated on

.bashrc vs .bash_profile, what is the difference?


This file loads each time a login happens.

# .bash_profile

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

# User specific environment and startup programs


export PATH
Enter fullscreen mode Exit fullscreen mode


This file loads everytime we start a new bash session.

# User specific aliases and functions

alias login='kubectl exec -it'
Enter fullscreen mode Exit fullscreen mode

Note: 📚 In case you could not log into the linux machine due to problems in the bash configuration (.bashrc) file.
Press Ctrl+C immediately after login to prevent bash profile from loading.
A plain bash session opens. Correct the bash files. And login again.

Top comments (0)