Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I often use this way to make my executable appear in terminal. Is it good or bad? And why?

share|improve this question
1  
What is "your executable"? A program of your own? Do you share the system with other users? –  slhck Dec 18 '12 at 7:25
    
I mean file that can be execute, may be downloaded program or anything else. And I don't share my system with others. –  Amp Tanawat Dec 18 '12 at 7:28

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer
    
+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. –  richardneish Dec 18 '12 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.