Recall & Review
beginner
What is the PATH variable in Linux?
The PATH variable is a list of directories that the shell searches to find executable programs when you type a command.
Click to reveal answer
beginner
How do you view the current PATH variable in a Linux shell?
You can view it by typing
echo $PATH in the terminal.Click to reveal answer
beginner
How do you add a new directory to the PATH variable temporarily?
Use
export PATH=$PATH:/new/directory/path. This adds the directory for the current session only.Click to reveal answer
intermediate
How can you permanently add a directory to PATH for your user?
Add the export command to your shell's config file like
~/.bashrc or ~/.zshrc. For example: export PATH=$PATH:/new/directory/path.Click to reveal answer
intermediate
Why should you add new directories to the end of PATH instead of the beginning?
Adding to the end avoids overriding system commands. If you add to the beginning, your commands might replace standard ones, which can cause unexpected behavior.
Click to reveal answer
What command shows the current PATH variable?
✗ Incorrect
The command
echo $PATH prints the current PATH variable.How do you temporarily add /usr/local/bin to PATH?
✗ Incorrect
Use
export PATH=$PATH:/usr/local/bin to add it temporarily.Where do you add PATH changes to make them permanent for your user?
✗ Incorrect
User shell config files like
~/.bashrc or ~/.zshrc are used for permanent PATH changes.What happens if you add a directory to the beginning of PATH?
✗ Incorrect
Directories at the beginning of PATH have priority, so their commands override others.
Which symbol is used to separate directories in PATH?
✗ Incorrect
Directories in PATH are separated by colons (:).
Explain how to add a directory to your PATH variable temporarily and permanently.
Think about session vs config files.
You got /4 concepts.
Why is the order of directories in PATH important? Give an example.
Consider command priority and safety.
You got /4 concepts.