It isn't necessarily run; at the top of the standard .bashrc is this comment:
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
I believe there is an option to run bash terminal as a login shell or not. With Ubuntu, gnome-terminal does not normally run as a login shell, so .bashrc should be run directly.
For login shells (like the virtual terminals), normally the file ~/.profile is run, unless you have either ~/.bash_profile or ~/.bash_login, but they are not there by default. By default, Ubuntu uses only .profile.
The standard ~/.profile has this in it:
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
This runs .bashrc if it is available - assuming $BASH_VERSION is present in your environment. You can check for this by entering the command echo $BASH_VERSION, and it should display some information on version number - it should not be blank.
.profileis read at login time, not when you open a new terminal, unless there's a misconfiguration somewhere. Selah: did you change anything from the default configuration? Please runps -o command $$ $PPIDin a terminal and copy-paste the output. – Gilles 'SO- stop being evil' Jul 08 '12 at 18:50.bashrcin your home folder, right? – Jjed Aug 05 '12 at 08:08echo $SHELL. This happened to me and the shell was /bin/sh instead of bash. Fix it in /etc/passwd and its running .bashrc. – Joe Flynn Jan 28 '16 at 15:54$ rm -r ~– Rockstar5645 Apr 27 '20 at 19:21$HOME/.bash_profileworked. – K. Stopa Dec 01 '21 at 13:42~/.bash_profileworked is because Bash prefers to use that instead of~/.profileif it is found. – BadHorsie Mar 07 '23 at 10:03