LINUX / A CONCEPT NOTE

Shell Startup Chain

.bashrc vs .profile

~70 sec read

Overview · mechanism
pitfall · examples

01 / THE SHORT VERSION

The idea in a few sentences.

Linux shells read startup configuration files. Interactive login shells load /etc/profile then ~/.bash_profile, while non-login subshells load ~/.bashrc directly.

02 / FOLLOW THE MECHANISM

How startup initialization flows

  1. Login Shell

    SSH login starts, reading profile configurations to initialize shell environment.

  2. Interactive subshell

    user opens a new terminal window inside current session, skipping profile.

  3. Rc Load

    shell loads ~/.bashrc to configure custom shell variables, aliases, and terminal colors.

  4. Ready Prompt

    shell displays prompt, waiting for user instructions.

04 / COMMAND NOTES

Read the command, then the result.

Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.

EXAMPLE 01 · REFERENCE

reload bash configuration settings in the current session

source ~/.bashrc

EXAMPLE 02 · REFERENCE

start a new bash shell simulating interactive login credentials

bash --login

Explore command anatomy in the CLI lab