I work with new programmers a lot in my day job. The PATH variable in Unix (and Windows to a degree) is a source of huge confusion.
If you run a program and get
x: command not found, it's not clear to newbies why the command was not found or where the terminal was looking. Especially if you just downloaded or installed something and expect that it should run.
You can add things to your PATH with
export PATH=blah:$PATHand things start working, then the changes are gone the next time you boot up your computer and it's not clear what broke or how to fix it (remember, when you are getting started you get a ton of errors and try a ton of different things to fix them, with varying degrees of success).
Relative file paths (eg
tests/executable) are not solid concepts for newbies, and any tutorials that reference relative file paths and are run from the wrong relative location will fail.
The whole idea that the first argument in a command is the executable, lives somewhere in the filesystem, and can be retrieved with a command like
whichis not intuitive, and could use some explanation.
I've done some searching on SO and on Google and haven't found a great, canonical answer to these questions that's directed at newbies. I would love it if Stackoverflow could host the answer to all of these questions in one place. I did ask the question: What is the Unix PATH variable and how do I add to it? and it's getting downvoted to hell.
Would appreciate your thoughts.