From the course: Cert Prep: LPIC-1 Exam 101 (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.
The PATH and command execution - Linux Tutorial
From the course: Cert Prep: LPIC-1 Exam 101 (Version 5.0)
The PATH and command execution
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 a terminal type in echo, space, dollar sign, capital P-A-T-H, and hit enter. Each directory has been limited 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 a 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
Simple and compound commands5m 59s
-
(Locked)
Modify the shell environment6m 42s
-
(Locked)
Command history3m 30s
-
(Locked)
The PATH and command execution3m 29s
-
Named and unnamed pipes3m 58s
-
(Locked)
Use input-output redirection (>, >>, |, 2>, etc.)5m 2s
-
(Locked)
Use text filters7m 3s
-
(Locked)
Find files using locate4m 51s
-
(Locked)
Finding files with find4m 47s
-
(Locked)
Finding text in files with grep5m 55s
-
-
-
-
-
-
-