I recently downloaded Master PDF Editor. It's a proprietary software for Linux and the archive contained bascically only a *.desktop file and the actual binary.
Looking at the *.desktop file, the binary is supposed to be placed in /opt/master-pdf-editor-3
. I'm aware I could change that but I followed the suggestion. Naturally, I still cannot call the binary on its own since it's not in my PATH.
I can think of several solutions. I could add the binary path to PATH, I could create a (soft or hard) link inside a folder that already is in PATH, such as /usr/bin
, or I could write a shell script in the same place that will call the binary.
I was wondering, is there some sort of commonly accepted best practice or rule when to use one over the other?
If it matters, I'm on Arch Linux.
P.S. This question is very similar but the focus there is on the directory structure and not on the different possibilities how to call the binary itself.
Best Answer
Creating a hardlink should probably be avoided, there's no need for one and a symlink is simpler and safer. Your other solutions are also fine though. You can create as script that calls the binary or you can add the directory to your
PATH
. The latter might be preferable if you expect to add other binaries in/opt
as well.This is essentially a matter of preference. In such cases, usually the simplest solution is the best. So, just create a soft link and you're all set:
Alternatively, of course, you could just call the binary with its full path:
Finally, if it's only for your user, you can create an alias by adding this line to your shell's initialization file (e.g.
~/.bashrc
):Anyway, no, there isn't any single Best Way© to do this. It depends on how you want your system to be set up and your own preferences as the system's administrator.