Shell Startup Jun 2026

When a login shell exits, Bash looks for ~/.bash_logout . This file is useful for cleanup tasks, such as clearing the screen or clearing command history for security purposes when logging out of a shared server.

You can add the following configurations to your .bashrc file (usually located in your home directory, e.g., ~/.bashrc ). If the file doesn’t exist, create it. shell startup

After reading these, Bash usually does not read ~/.bashrc automatically unless explicitly sourced (common in many distros' default ~/.bash_profile ). When a login shell exits, Bash looks for ~/

| Goal | Recommended File | |------|------------------| | Environment variables ( PATH , EDITOR ) that must be in interactive login shells | ~/.profile (POSIX) | | Aliases, prompt, shell options for interactive use | ~/.bashrc (Bash) / ~/.zshrc (Zsh) | | Commands only on login (e.g., motd, fortune) | ~/.bash_profile or ~/.zlogin | | Cleanup on logout | ~/.bash_logout | If the file doesn’t exist, create it

Ensure you have completion installed and sourced.