If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
PATH is how your shell knows where to find programs
Illustration of a smiling stick figure with curly hair, and shell, represented by a box with a smiley face.
person: run python3
PATH is
/bin
/home/bork/bin
/usr/bin
shell, thinking:
/bin/python3
? nope, doesn’t exist
/home/bork/bin/python3
? nope, doesn’t exist
/usr/bin/python3
? there it is!!! I’ll run that!
how to add a program to your PATH
find the folder the programs is in
update your shell config to add it to your
PATH
restart your shell, for example by opening a new terminal tab
…but how do you find the folder
- think about how you installed it
person (thinking): hmm, I used the Rust installer, where does that install things?
- a brute force search
find / -name python3 | grep bin
PATH
ordering drama
person (thinking): ugh, no, don’t run THAT python3
, run the other one!
You can prioritize a folder by adding it to the beginning of your PATH
gotcha: not everything uses your shell’s PATH
cron jobs usually have a very basic PATH
, maybe just /bin
and /usr/bin
In a cron job I’ll use the absolute path, like:
/home/bork/bin/someprogram
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!