Script Valley
Developer Environment Setup (WSL, Terminal, VS Code)
Shell Configuration and ProductivityLesson 3.1

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 loading flow diagram

.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 ~/.bashrc

Adding a configuration and reloading

export EDITOR=code
export NODE_ENV=development

source ~/.bashrc

source (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_ENV

Always 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.

Up next

How to create shell aliases to speed up your workflow

Sign in to track progress

What is .bashrc and how to configure your shell environment โ€” Shell Configuration and Productivity โ€” Developer Environment Setup (WSL, Terminal, VS Code) โ€” Script Valley โ€” Script Valley