๐ Configuring Shell Profiles
Shell profiles allow you to customize your interactive session โ define aliases, set environment variables, and load helper functions automatically.
๐ File Types Overview
Different shells look for different startup files depending on whether theyโre login shells or interactive non-login shells.
Common Files
| File | Used By | When Loaded |
|---|---|---|
.profile |
sh, bash (login) | Login shells |
.bash_profile |
bash | Login shells |
.bashrc |
bash (non-login) | Interactive non-login shells |
.zshrc |
zsh | Always loaded |
.zprofile |
zsh (login) | Login shells |
Note: On macOS since Catalina,
zshis default; older versions usedbash.
๐ Loading Order Example (Bash)
- Login shell loads:
/etc/profile-
First found among:
~/.bash_profile,~/.bash_login,~/.profile -
Non-login interactive shell loads:
~/.bashrc
So many developers put this in their ~/.bash_profile:
1 2 3 | |
๐งฐ Practical Customizations
Aliases
Add shortcuts for frequently used commands:
1 2 3 | |
Environment Variables
Set global settings:
1 2 3 | |
Functions
Define reusable logic:
1 2 3 | |
Path Extensions
Add custom directories to $PATH:
1 | |
๐งผ Keeping Things Organized
As your config grows, split it into logical parts:
1 2 3 4 5 | |
Then source them from your main profile:
1 2 3 | |
๐ Continue to: Cross-Platform Testing Setup