

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Compiled vs. Interpreted
incomplete
2: Executables
incomplete
3: Shebang
incomplete
4: Bourne Shell
incomplete
5: Environment Variables
incomplete
6: PATH
incomplete
7: Change Your PATH
incomplete
This lesson's interactive features are locked, please to keep using them
This is one of the most important lessons in this entire course! Listen up.
There are environment variables that are sort of "built-in" to your shell. By "built-in" I just mean that different programs and parts of your system know about them and use them. The PATH variable is one of those.
PATH?If it weren't for the PATH, you'd have to remember the filesystem path of every executable you wanted to run in your shell. Instead of just running ls, you'd have to run /bin/ls (or whatever the location of the ls executable is on your system). That's not very convenient.
The PATH variable is a list of directories that your shell will look into when you try to run a command. If you type ls, your shell will look in each directory listed in your PATH variable for an executable called ls. If it finds one, it will just run it. If it doesn't, it will give you an error like: "command not found."
PATH Variable?Take a look at your current PATH variable:
echo $PATH
You should see a list of directories separated by colons (:). Here in the browser, you'll see:
/usr/bin/binEach of those directories is a place where your shell will look for executables. A more realistic PATH for your local machine might look like this:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Which means your shell will use all these directories to look for executables:
/usr/local/bin/usr/bin/bin/usr/sbin/sbinPrint the contents of your current PATH. You should see a colon-separated list of directories. Those are the places your shell looks for the commands you type.
Submit the shell checks.