Background: One of my colleagues who doesn't come from a Linux background asked me about using ./ before some commands and not others, so I explained to him how PATH works and how binaries are chosen to be run. His response was that it was dumb and he just wanted to not need to type ./ before commands.
Question: Is there a way to easily modify the behavior of the shell such that $PWD is always the first item on PATH?
If you really want to, you can do this by prepending . to your path:
However, that’s a bad idea, because it means your shell will pick any command in the current directory in preference to others. If someone (or some program) drops a malicious ls command in a directory you use frequently, you’re in for trouble...
~/binand make it part of
PATH? This keeps things organized ,too.
PATH(which is the usual source of such considerations).