CertGrid CertGrid
Hands-on Lab·LPIC-1

Login shells and which file is read

Objective 105.1 is about customising the shell environment, and the part that catches people is which file is read when. This guide inserts a marker into every startup file, starts bash as a login shell, an interactive shell and a script, and reads back exactly which files each one loaded - then shows what a child process inherits and what it silently does not.

102: Shells and Scripting Guide 31 of 33 Intermediate

The Debian-family host. Both dotfiles are copied before editing and restored from those copies, with a `diff -q` on each.
Server NameIP AddressOSRolesCPURAMHDD
LPIC1-A01192.168.0.76Ubuntu 26.04 LTSDebian-family host - dpkg and apt, which objective 102.4 names2 Core4 GB50 GB

This guide includes

Use this when something works when you log in and fails from cron, a script or a systemd unit. This matters because a non-interactive shell reads none of the files you have been editing, and because an alias that works perfectly in your terminal does not exist anywhere else.

Before you start

  1. Which shell is even running

  2. Marking every file so it says when it was read

  3. A login shell

  4. An interactive shell that is not a login shell

  5. The shell a script gets

  6. What a child process inherits, and what it does not

  7. Where PATH comes from and which file wins

  8. Putting the account back

Official sources