Skip to content
Learn Netverks

Lesson

Step 4/36 11% through track

shell-environment-preview

Shell environment preview

Last reviewed May 28, 2026 Content v20260528
Track mode
none
Means
Read / quiz
Reading
~2 min
Level
beginner

This lesson

This lesson teaches Shell environment preview: the syntax, patterns, and safety habits you need before advancing in Bash.

Teams still ship Shell environment preview in Bash codebases—skipping it leaves gaps in debugging and code reviews.

You will apply Shell environment preview in contexts like: CI jobs, server maintenance, local dev automation, and Git hooks.

Read each lesson, copy bash examples into your own terminal, and complete the lesson MCQs—there is no in-browser runner for security reasons.

At the start of the track—complete before lessons that assume you can run commands in your own terminal.

Every command inherits an environment: variables like PATH, the current working directory, open file descriptors, and shell options. Understanding the environment prevents “command not found” and permission surprises.

Key environment pieces

  • PATH — directories searched for executables
  • HOME — your home directory
  • PWD — present working directory (maintained by the shell)
  • USER / LOGNAME — account identity

Inspecting the environment

echo "Home: $HOME"
echo "Path: $PATH"
printenv | head
which bash
which git

which searches PATH. If Git lessons fail, compare with Git intro install steps in Tools.

Startup files

Login shells read profile files (/etc/profile, ~/.bash_profile). Interactive shells may read ~/.bashrc. Distros differ—when something works in one terminal but not another, compare which file ran.

Important interview questions and answers

  1. Q: What does PATH control?
    A: Which directories are searched, in order, when you type a command name without a full path.
  2. Q: printenv vs env?
    A: Both list environment variables; env can also run a command with a modified environment.

Self-check

  1. Which variable holds your home directory path?
  2. What command shows where the bash executable lives?

Tip: If command not found appears, echo $PATH and compare with Tools install docs.

Interview prep

What is PATH?

Ordered list of directories searched for executable names.

printenv purpose?

Lists environment variables exported to child processes.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • PATH order?
  • HOME vs PWD?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump