I often use this way to make my executable appear in terminal. Is it good or bad? And why?
2 Answers
There's nothing wrong with leaving a symlink to an executable in /bin
. In fact, it could be a very clean way of managing your executables, compared to putting every single executable's path in your $PATH
.
So, instead of having, for example, /usr/local/bin:/usr/bin:/bin
in your $PATH
, you'd have /home/user/foo/bin:/home/user/bar/bin:/yet/another/bin:/usr/local/bin
, etc. which would be hard to maintain. Plus, you'd have to set up your custom path for all shells, whereas simply putting the symlink into /bin
makes it available to any shell right away.
But this is your choice. Often, programs will have to have a FOO_HOME
variable set, pointing to their directory, e.g. TOMCAT_HOME
, which contains a bin
directory of its own.
Maybe you should consider using /usr/bin
instead of /bin
, because the latter is usually reserved for essential system binaries that are available to all users, and /usr/bin
is for non-essential binaries.
Even better would be to use /usr/local/bin
, since /usr/local
is the default place for anything you've installed yourself, as a user—so anything that is not part of a default system installation. If /usr/local/bin
is not in your $PATH
, you should of course add it.
To find out more about the directory organization, read the Filesystem Hierarchy Standard.
-
+1 for /usr/local/bin. The /bin and /usr/bin directories should be maintained by the package manager, /usr/local/bin should be used for programs installed manually, and useful shell scripts. Dec 18, 2012 at 9:42
/bin
is used for executables used by the kernel. /usr/bin/
Is I think for your distibutions package manager. You can freely add links to your executables to /usr/local/bin
which is typically where software that you compile would install themselves with a make install
The ideal method is to add ~/bin
to your path, create that folder in your home directory and just use that folder.
Of course all this is mostly about neatness, elegance, correctness, etc. I cant think of a reasonable technical flaw in linking directly to /bin
as long as you do it correctly with no mistakes ever.