From the course: Cert Prep LPIC-1 Exam 102 (Version 5.0)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Set command search path

Set command search path - Linux Tutorial

From the course: Cert Prep LPIC-1 Exam 102 (Version 5.0)

Start my 1-month free trial

Set command search path

- [Instructor] Bash has some pre-specified locations to look for commands in. These locations are stored in a variable called path. When you type in a command, Bash will look for the command in each of the directories in the path variable and execute the first one it finds. This means if you have the same command in more than one directory, the one that it finds first will get executed. We can look at the path variable using the echo command. In the terminal type in echo space dollar sign capital PATH and hit Enter. Each directory is delimited by a colon and Bash looks from the left to the right. This variable will have different contents depending on the user and the users can add directories to their copy as well. If you want to search for command in the path without using the more complex find or locate commands, just use the which command. Type in which space and then the command. In this case I'll use tar and hit…

Contents