Shell Environment
Challenge Gallery
Quick Reference
Shell configuration files:
| File | When sourced |
|---|---|
.bash_profile |
Login shells (SSH, first terminal) |
.bashrc |
Interactive non-login shells |
.profile |
Login shells (sh-compatible) |
.bash_logout |
When a login shell exits |
Common customizations in .bashrc:
# Aliases
alias ll='ls -la'
alias gs='git status'
# PATH additions
export PATH="$HOME/bin:$PATH"
# Custom prompt
PS1='\u@\h:\w\$ '
Common Pitfalls
- .bash_profile vs .bashrc – Put settings in .bashrc and source it from .bash_profile. Otherwise settings may not apply in all terminal types.
- Missing export – Variables without export are invisible to child processes.
- PATH order – Directories are searched left-to-right. Put your custom directories first to override system commands.
- Syntax in assignments – No spaces around
=.VAR = hellois wrong (runs VAR as a command). UseVAR=hello.