There are different ways to Rome, but the preferred, conventional way is to add an executable to your search
PATH, rather than adding a directory to the PATH.
Imagine, it would become very unwieldy if you decided to add a directory to your search path for every new executable you install.
To add the executable to your existing search PATH, there are two options.
- Create a symlink in a directory that exists in your search path
- Create a wrapper script in a directory that exists in your search path.
Such symlink or script should be placed in
~/.local/bin if only the current user should be able to run the command, or in
/usr/local/bin if the command should be available to any user.
- To create a symlink:
ln -s /path/to/executable /usr/local/bin/mycustombrowser
- A wrapper script, e.g. named
/usr/local/bin/mycustombrowser at minimum launches the actual executable using the full path name, but could also change directories, set environment variables, etc., e.g.:
To be executable, the executablele bit of the script file must be set.
Do not put such executable in
/usr/bin or other directories: these are managed by your package management system. The directories under
local are conventionally designed for your manually installed applications, and these actually will everride similarly named executables in the other directories in the PATH.
Then, if the need is more temporary, one could also create an alias:
Also this way, an executable can be launched simply by typing a name instead of the full path. An alias can be added to
.bashrc to be available automatically for the current user.
If, after all this, there still is a need to change the actual
PATH, then here is how to do that.