$linuxjunkies
>

login shell

also: login interactive shell, interactive login shell

A shell that is invoked when you log in to a Linux system, which reads initialization files to set up your environment. It is responsible for executing login-specific configuration and spawning your interactive session.

A login shell is the initial shell process started when you authenticate to a Linux system via a terminal, SSH, or console. Unlike a non-login subshell, it reads and executes initialization files such as /etc/profile, ~/.bash_profile, ~/.zprofile, or ~/.profile to configure environment variables, aliases, and other session settings.

For example, when you SSH into a remote server, bash is invoked as a login shell, which sources your ~/.bashrc and ~/.bash_profile to set up your PATH, load functions, and apply custom configurations. This ensures your personalized environment is ready for work.

You can identify if a shell is a login shell by checking the $- variable or using shopt login_shell in bash. Non-login shells (like those opened within a terminal window or subshells) skip initialization files and inherit the parent shell's environment instead.

Related terms