Linuxlab

Chapter 11

The shell environment and configuration

Updated July 3, 2026

Every process has an environment, a set of variables it receives at startup and passes on to its children. The shell keeps the program search path, the home directory, the current language, and much more in them. Half of the "works for you, not for me" cases come down to a difference in environment variables.

View the variables:

$ env             # all environment variables
$ echo $HOME      # the value of one variable
$ echo $PATH      # where the shell looks for programs

Your own variables and export

You can set a variable right in the shell. Without export it stays in the current shell only; with export the programs you start from it inherit it.

$ name=Anna            # a plain variable, visible here o
Locked

The rest of this chapter is part of a paid course

You are reading the open part. Buy the course to read the whole chapter.

See the course