What is .bashrc and how to configure your shell environment
.bashrc vs .bash_profile, source command, login vs interactive shells, when .bashrc loads, editing with nano or vim, testing changes
Understanding .bashrc
.bashrc is a shell script that Bash runs automatically every time you open a non-login interactive terminal. It is where you put aliases, environment variables, and any shell customization you want available in every session.
.bashrc vs .bash_profile
.bash_profile runs once at login (SSH session, WSL2 first launch). .bashrc runs for every new interactive shell. Most configurations belong in .bashrc because VS Code terminals, split panes, and new tabs all trigger it.
Editing .bashrc
nano ~/.bashrc
# or
code ~/.bashrcAdding a configuration and reloading
export EDITOR=code
export NODE_ENV=development
source ~/.bashrcsource (or its shorthand .) executes the file in the current shell rather than a subprocess, so changes take effect immediately.
Verifying changes
echo $EDITOR
echo $NODE_ENVAlways test after sourcing. A syntax error in .bashrc can prevent your shell from loading. If that happens, open a new terminal, fix the error, and source again.
