Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

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.

  1. 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.

  2. You can add things to your PATH with export PATH=blah:$PATH and 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).

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

  4. 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 which is 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: http://stackoverflow.com/questions/13815966/what-is-the-unix-path-variable-and-how-do-i-add-to-ithttps://stackoverflow.com/questions/13815966/what-is-the-unix-path-variable-and-how-do-i-add-to-it and it's getting downvoted to hell.

Would appreciate your thoughts.

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.

  1. 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.

  2. You can add things to your PATH with export PATH=blah:$PATH and 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).

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

  4. 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 which is 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: http://stackoverflow.com/questions/13815966/what-is-the-unix-path-variable-and-how-do-i-add-to-it and it's getting downvoted to hell.

Would appreciate your thoughts.

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.

  1. 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.

  2. You can add things to your PATH with export PATH=blah:$PATH and 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).

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

  4. 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 which is 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: https://stackoverflow.com/questions/13815966/what-is-the-unix-path-variable-and-how-do-i-add-to-it and it's getting downvoted to hell.

Would appreciate your thoughts.

Source Link

Canonical resource for explaining the PATH

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.

  1. 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.

  2. You can add things to your PATH with export PATH=blah:$PATH and 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).

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

  4. 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 which is 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: http://stackoverflow.com/questions/13815966/what-is-the-unix-path-variable-and-how-do-i-add-to-it and it's getting downvoted to hell.

Would appreciate your thoughts.