I have a binary that can be executed with command "run-binary" (not the actual name) and determined that it is executing per the following path:
john@johns-PC:~$ which run-binary
/home/john/.local/bin/run-binary
I have downloaded and unpacked an updated version of run-binary. 2 questions:
- Per "best practices," where should I put the new, unpacked run-binary?
- How do I update /home/john/.local/bin/run-binary so that "run-binary" executes from the newly installed location after doing #1 above?
Names of executable files are search for in the folders that are listed in your PATH setting, and in that order.
An executable installed in
.local/bin
will thus take precedence over executables with the same name placed in the other folders listed.1. Per "best practices," where should I put the new, unpacked run-binary?
Definitely keep the one you want to use in
.local/bin/
. If you want to use the same command to launch it, then remame the previous version (e.g..local/bin/run-binary-versionnumber
) or move it to another folder, or, better, see next point.2. How do I update /home/john/.local/bin/run-binary so that "run-binary" executes from the newly installed location after doing #1 above?
If you want to keep previous versions of your executable around, good practice is to place each version in its dedicated folder, or perhaps, if it is a single executable, in the
.local/bin
folder but with a distinct name, e.grun-binary-versionnumber
. Then, you can create a symbolic link in.local/bin
that is named how you typically want to run it, e.g.run-binary
.That way, the version of your choice will be started when you run
run-binary
. You still can easily run other versions by giving the specific namerun-binary-versionnumber
.You can create symbolic links with the file manager, or with the command
This could be handled with the update-alternatives command.
I recommend checking out the man page for it. There you'll find the syntax for installing, listing, removing, selecting a preferred version of the binary programs to execute.
An example of the --list subcommand is
Detailed documentation can be found in