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".
More on Packages, Shell & Text Tools
Compare apt and dnf package management.BeginnerWhat is the difference between `apt upgrade` and `apt full-upgrade`?IntermediateHow do you find which package provides a file or command?BeginnerHow do you pin or hold a package version?IntermediateHow are repositories and their GPG keys configured?AdvancedWhat does `set -euo pipefail` do in a bash script?Intermediate