Skip to Content
Navigation:

A stick figure smiling

If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

Image of a comic. To read the full HTML alt text, click "read the transcript".

browse more comics! get the zine!
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

  1. find the folder the programs is in

  2. update your shell config to add it to your PATH

  3. 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!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2024 | All rights reserved (see the FAQ for notes about licensing)