nerdexam
LPI

010-160 · Question #86

What is the purpose of the PATH environment variable?

The correct answer is A. It allows the execution of commands without the need to know the location of the executable. The PATH variable holds a colon-separated list of directories the shell searches when resolving command names, enabling commands to run without specifying their full path.

The Power of the Command Line

Question

What is the purpose of the PATH environment variable?

Options

  • AIt allows the execution of commands without the need to know the location of the executable.
  • BIt increases security by preventing commands from running in certain locations.
  • CIt specifies the location of a user's home directory.
  • DIt indicates the location of the default shell to be used when a user logs in.
  • EIt contains the absolute path to the current directory.

How the community answered

(22 responses)
  • A
    91% (20)
  • C
    5% (1)
  • D
    5% (1)

Why each option

The PATH variable holds a colon-separated list of directories the shell searches when resolving command names, enabling commands to run without specifying their full path.

AIt allows the execution of commands without the need to know the location of the executable.Correct

When a user types a command, the shell iterates through each directory listed in PATH in order, looking for a matching executable file. This mechanism allows users to run programs like ls or grep by name alone rather than typing full paths like /bin/ls.

BIt increases security by preventing commands from running in certain locations.

PATH does not restrict or block command execution in any directory - it is a lookup list, not an access control mechanism.

CIt specifies the location of a user's home directory.

The home directory is specified by the HOME environment variable, not PATH.

DIt indicates the location of the default shell to be used when a user logs in.

The default login shell is specified by the SHELL environment variable and configured in /etc/passwd, not PATH.

EIt contains the absolute path to the current directory.

The current working directory is stored in the PWD environment variable, not PATH.

Concept tested: Linux PATH environment variable purpose

Source: https://www.gnu.org/software/bash/manual/bash.html#Command-Search-and-Execution

Topics

#PATH variable#environment variables#command execution#shell environment

Community Discussion

No community discussion yet for this question.

Full 010-160 Practice