I always have ~/bin added to the $PATH in my ~/.profile. As is default in Ubuntu.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then

However, when trying out software, hacking together a script, or testing new software that has no PPA's, makefiles and such, I prefer to organize them in directories. For example (I have about twelve of these projects in my ~/bin at this moment):

ber@audrey:~ ☙ ls bin/replicatorg-0033/
contributors.txt  examples  lib-i686    license.txt  readme.txt   scripts        todo.txt
docs              lib       lib-x86_64  machines     replicatorg  skein_engines  tools

This is some java application. replicatorg is the executable.

Now, I could do four things, but I am looking for another, better way:

  1. Symlink the exectuable in ~/bin. ln -s bin/replicatorg-0033/replicatorg bin/replicatorg. This sometimes works, not in this case. The application is poorly written and expects libraries relative to its binary: it will not run when symlinked or copied out of its directory.
  2. Add every subdirectory to $PATH as well. But that means editing ~/.profile everytime I move, download or git-clone new directories.
  3. Install the applications properly systemwide by creating a makefile/install script. Seen as that most of the applications are quick hacks, ugly, in development, scripts and tools, that is not a good idea, IMHO.
  4. Move all the contents of ~/replicatorg-0033/ into ~/bin. Right.

So: how do you organize your ~/bin?


I create a separate directory for holding packages (~/apps). If there is a program that I want to have in my $PATH, I either create a symlink in ~/bin or create a shellscript wrapper in ~/bin if the program in question does not like symbolic links:

~/apps/package/bin/someprogram "$@"

For larger packages with a lot programs, adding the directory to your $PATH may be more preferable to avoid creating (and forgetting to create) symlinks in ~/bin. This depends on your personal preferences though.

  • I like the notion of wrapper shellscripts. It goes well with my other practice to keep vanilla source of applications in ~/src. Thanks! – berkes May 7 '12 at 12:11
  1. Add every subdirectory to $PATH as well. But that means editing ~/.profile everytime I move, download or git-clone new directories.

No need to edit every time, try something like this:

if [ -f ~/bin ]; then
   for i in $( find ~/bin -type d ); do

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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