If you can't remember the name of the variable that lets you run commands from any location, what would you type to find out?

Study for the OSCP Linux Exam. Use our flashcards and multiple-choice questions to test your skills. Each query comes with detailed hints and explanations to enhance your preparedness. Get ready to conquer the exam!

Multiple Choice

If you can't remember the name of the variable that lets you run commands from any location, what would you type to find out?

Explanation:
When you don’t remember the variable that controls where executables are found, you start by listing all environment variables and looking for PATH. The PATH variable holds a colon-separated list of directories that the shell searches in order when you type a command, which is why you can run commands from anywhere. Using a command that prints environment variables, like printenv, makes it easy to spot PATH and see its value. Once you find it, you’ll see which directories are searched. Echoing PATH would show the value directly if you already know the variable’s name, but printenv helps you discover that name in the first place.

When you don’t remember the variable that controls where executables are found, you start by listing all environment variables and looking for PATH. The PATH variable holds a colon-separated list of directories that the shell searches in order when you type a command, which is why you can run commands from anywhere. Using a command that prints environment variables, like printenv, makes it easy to spot PATH and see its value. Once you find it, you’ll see which directories are searched. Echoing PATH would show the value directly if you already know the variable’s name, but printenv helps you discover that name in the first place.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy