login shell

Quick notes on login shells—the advantages, how they load configuration, and related resources—so I can troubleshoot them faster.

May 15, 2024 · 1 min read · 98 Words · -Views -Comments · Programming
Linux 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

A WebShell user recently reported that logging into a Debian terminal wasn’t loading ~/.profile. After digging around, I found they were dropped into an interactive non-login shell, so the login-only configs never ran.

Login Shell

A login shell loads ~/.bash_profile, .profile, and /etc/profile. A non-login shell skips those but does source ~/.bashrc.

Profile Load Order

  1. /etc/profile: the shell reads the global configuration first.
  2. ~/.bash_profile, ~/.bash_login, and ~/.profile (in that order): it stops at the first file that exists and is readable. If ~/.bash_profile is present, the shell doesn’t process the others; otherwise it falls back to the next.
Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover