Rather than adding a bunch of different directories to $PATH - it might make more sense to add a personal bin directory to your home directory.
Literally just run
mkdir ~/bin/
, add $HOME/bin to $PATH, then log out and log back in again to let the changes take effect. As
@Fanboi said, some distros are already set up to check for the existence of a bin directory in $HOME and will add it to $PATH.
$HOME/.local/bin is another path that is commonly added - so that's potentially another one you might want to add. If the distro is already set up for a personal bin directory at either of those locations, you just need to create the directory and log out and back in again.
Whatever you choose: With a personal bin directory set up, you can put any personal scripts, or compiled executables that you have built from source into there and you can access them from anywhere in the filesystem. As long as the files in ~/bin are executable, you can run them as if they were a properly installed program.
Also you can put symbolic links to executables in other directories.
e.g.
Bash:
ln -sT /path/to/executable linkName
Where
/path/to/executable
is the path to the executable you want to run and
linkName
is the name you want to give the symbolic link.
To run the program being pointed to you'd type
linkName
from anywhere in the system.
And sometimes a program you've downloaded might require you to be in a particular working directory in order for the executable to run, so you could also create a "wrapper" script in your personal bin directory which will cd into that directory, run the program and then cd back to the original directory.
e.g.
For urban terror I have a script called urt:
Bash:
#!/usr/bin/env bash
cd ~/path/to/urban\ terror/
./urbanterror-executable
cd -
Note: I'm not at my Linux PC at the moment, I'm on my W11 work laptop, so the above isn't the exact script it's just the general jist of it:
- cd into the directory which contains the executable and all of its resources/dependencies.
- Run the executable
- cd back to the directory we were originally in.
Anyway, I hope that helps. It seems like you're already au-fait with changing $PATH, so I didn't include instructions on modifying $PATH. Also I've made several previous posts here about setting up a personal bin directory and cannot be bothered to repeat myself again (feel free to search 'personal bin directory' and my username and you should be able to find the other posts I've made on this topic).
But above are my brief tips for setting up and using a personal bin directory.
In a similar fashion, you can also set up a personal man directory and create and add your own man pages to document your own scripts.