Interview Prep/Linux/Packages, Shell & Text Tools

What is the difference between a login shell and an interactive non-login shell?

IntermediateConceptPackages, Shell & Text Tools
Answer

A login shell (SSH login, su -, bash -l) reads /etc/profile, then the first of ~/.bash_profile, ~/.bash_login, ~/.profile. An interactive non-login shell (new terminal tab, plain bash) reads ~/.bashrc (and /etc/bash.bashrc on Debian). Non-interactive shells (scripts, cron) read neither, unless BASH_ENV is set. That is why "it works in my terminal but not in cron".

All Linux questions Roadmap: Linux

More on Packages, Shell & Text Tools