Site Tools


terminal:shell:profile

profile and profile.d

Files: ~/.profile, ~/.profile.d/00-env.sh, ~/.profile.d/10-aliases.sh, ~/.profile.d/20-functions.sh, ~/.profile.d/30-tools.sh

~/.profile

Executed for login shells. Three jobs:

  1. Sources ~/.bashrc if bash is running
  2. Adds ~/bin and ~/.local/bin to PATH
  3. Runs the tilde.town welcome on new user first login (~/.newuser check)

~/.profile.d/00-env.sh — Environment Variables

export EDITOR=micro
export VISUAL=micro
export PAGER=less
export LESS="-R"                    # pass ANSI colours through less
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export TZ=America/Calgary
export TERM=xterm-256color
export COLORTERM=truecolor
export HISTSIZE=10000
export HISTFILESIZE=20000
export HISTCONTROL=ignoreboth:erasedups
export GPG_TTY=$(tty)

~/.profile.d/10-aliases.sh — Modern Tool Aliases

Aliases with availability checks — gracefully falls back to standard tools:

# eza replaces ls (if available)
if command -v eza &> /dev/null; then
    alias ls='eza --icons --git'
    alias ll='eza -l --icons --git'
    alias la='eza -la --icons --git'
    alias lt='eza --tree --level=2 --icons --git'
fi
 
# ripgrep replaces grep (if available)
if command -v rg &> /dev/null; then
    alias grep='rg'
fi
 
# bat replaces cat/less (if available)
if command -v bat &> /dev/null; then
    alias cat='bat'
    alias less='bat'
fi
 
# fastfetch replaces neofetch (if available)
if command -v fastfetch &> /dev/null; then
    alias neofetch='fastfetch'
fi
 
alias ttbp='~/.ttbp/bin/ttbp'
alias town='town'

~/.profile.d/20-functions.sh — Shell Functions

Function Usage Description
mkcd mkcd dirname mkdir + cd in one step
extract extract file.tar.gz Universal archive extractor (tar, zip, bz2, rar, 7z…)
replace replace old new file sed in-place find/replace
ff ff pattern Find files by name pattern
fd fd pattern Find directories by name pattern
myip myip Get current public IP (via ifconfig.me)
backup backup file Copy file with datestamped suffix
gitinit gitinit git init + initial commit
path path Print PATH one entry per line

~/.profile.d/30-tools.sh — Tool Initializations

All wrapped in availability checks:

Tool Init method
fzf Sources ~/.config/fzf/fzf.bash
starship eval “$(starship init bash)”
nvm Sources $NVM_DIR/nvm.sh
pyenv eval “$(pyenv init -)”
rbenv eval “$(rbenv init -)”
direnv eval “$(direnv hook bash)”
asdf Sources ~/.asdf/asdf.sh

See Also

terminal/shell/profile.txt · Last modified: by 127.0.0.1