Ubuntu – Why does /usr/local/bin not exist on the (Ubuntu 16.04) system

16.04directory-structure

I've just reinstalled Ubuntu 16.04 on my machine, and I'm in the process of installing everything I had installed previously. This includes a few programs that I put in /usr/local/bin, but that directory doesn't seem to exist:

$ ls -A /usr/local
etc  games  include  lib  man  sbin  share  src

I don't remember explicitly creating /usr/local/bin on my old install, and yet it existed there. Why doesn't it exist by default, and how did it come to exist on my previous installation?

Best Answer

/usr/local/bin and other default folders such as the ones you mentioned and also /opt and /mnt are created during a normal Ubuntu installation. By default the folders are empty. If you don't have the folder, it simply means it has inadvertently been removed.

This is easily rectified just by creating the folder:

$ sudo mkdir /usr/local/bin

You can proceed to install your previously installed programs just as you normally would have, if the directory had not been deleted, after recreating it.

And more directly to your questions:

  • Why doesn't it exist by default?
    It is created by default during installation.
  • How did it come to exist in your previous installation?
    It's part of the default directory structure which was created during installation.