Good day everyone,
First I wanted to thank the people who run Codecademy, that place like this exists !
In the lesson Environment variables 4.8 while following the instructions for the variable $PATH, there is a part which says;
After Typing by instructions 1. echo $PATH and Enter, instructions says : Looking carefully, echo $PATH lists the following directories: … _Each directory contains scripts for the command line to execute. The PATH variable simply lists which directories contain scripts.
After Typing by instructions 2 /bin/pwd … is terminal supposed to output a file or script that contains this command ? And what are the scripts, are they actual files that can be found in the directories that **echo $PATH" lists.
Anyone can explain this ?
you don’t understand how $PATH works? It is a bit difficult. Lets look at this string:
(i know, slightly different then the lesson, but i couldn’t copy it from the lesson). What is happening? This is a string which contains all the locations where executable files are. They are separated by the colon, so we have 3 paths:
why are paths important? If you type
cd in the terminal, it going to check all directory’s in your
PATH variable to find the command (program) to execute. You can verify this, if you run:
it will show:
he, /usr/bin is in our
PATH. It would be impractical to type /usr/bin/ls each time. The path does this for us It also gives you the option to create directory in your home directory (outside codecademy), which you can add to your path, and store personal scripts
I hope this explains what path does, and why it is rather useful
Thanks stetim94 I pretty much get the feeling of how PATH works.
And when you mention storing personal scripts, what are you referring to ?
Are scripts files that are stored in the PATH ? can you open and edit the script somehow ?