I want to install a program in Linux and run it as a daemon. (Team Speak 3 in this case, but the question is general in nature). There is no package provided, only tarred binaries.

Where in the directory structure should I put such a program by convention?

On the web I found that /opt is for "optional addon apps", while /usr is for "user programs".

I found one tutorial suggesting /opt while another suggested /usr.

So which one is "more correct"?

  • 3
    The "more correct" depends on your distribution. You should check your distribution's guidelines on where to put software that isn't managed by the package manager (often /usr/local) OR on how to create your own package for it.
    – Leiaz
    Apr 29, 2014 at 11:31
  • 2
    Thank you Leiaz. Your comment helped me to find the answer (askubuntu.com/questions/1148/…). So I guess it should be /opt in my case (Using Linux Mint, which is based on Ubuntu) and the application is using a single folder. If you convert your comment into an answer, I will accept it.
    – Eiver
    Apr 29, 2014 at 11:41
  • The convention is bad. Ignore the convention. Make ~/apps or ~/programs and put your programs in there. Make ~/apps/binaries or ~/apps/on-path, add that to your $PATH env var, and symlink the programs you want into binaries.
    – iono
    Jul 29, 2022 at 17:31
  • 1
    @iono Convention is good when you're installing a package that will be used by more than one person. Installation in /usr/local is globally accessible, installation in ~onealdw/apps cannot be accessed by any user other than myself.
    – doneal24
    Dec 7, 2022 at 20:46
  • Yes, I was asking here about a program, which would run as a service (daemon) (even when all human users are logged off), not a personal app that some user would run from their home directory.
    – Eiver
    Dec 8, 2022 at 11:35

8 Answers 8


The "more correct" depends on your distribution. You should check your distribution's guidelines on where to put software that isn't managed by the package manager (often /usr/local) OR on how to create your own package for it.

As you said, TeamSpeak just put everything in one folder (and may not be easy to reorganise), yes /opt/ is probably best.

(But, for instance, in Arch Linux, the package manager can install there, so I'd still make a PKGBUILD to install in /opt.)

Also distributions usually try to follow the Filesystem Hierarchy Standard, so this is where to look for more generic conventions.

  • is there some alias to know where are located each directory by usage? (for example, where to put root configurations, where to put binaries, dependencies, templates...)
    – Sandburg
    Feb 5, 2019 at 11:09
  • Usually you put your downloaded folder in /opt and create a symbolik link from /usr/bin. If the app has a GUI a very useful thing to do is to create a NAME.desktop file in /home/USER/.local/share/applications such that you will see it from the main menu. unix.stackexchange.com/a/103222/130710
    – tuxErrante
    Mar 8, 2020 at 18:10

Where to install a program?

If you will be compiling your own software then you ultimately control the installation location.

  • By convention, software compiled and installed manually (not through a package manager, e.g apt, yum, pacman) is installed in /usr/local.
  • Some packages (programs) will create a sub-directory within /usr/local to store all of their relevant files in, such as /usr/local/openssl.
  • Other packages will install their necessary files into existing directories such as /usr/local/sbin and /usr/local/etc.
    These are simply default locations and can be changed during compilation.

Define installation location when running ./configure

When you are compiling software, the installation location can be specified by using the --prefix= option when running ./configure. It is highly recommended that you look at all of the available options for your package by running $ ./configure --help | less. Additionally, browsing the INSTALL and README documents provided with your package is a good idea. They tend to include installation instructions and dependency information that is specific to the package.

Please Note

It should also be noted that although you can store software anywhere, according to the FHS, source code for locally installed software should be stored in /usr/local/src!

Standardizing where you store your source trees will allow you to easily locate a tree if you need to copy a stock configuration file or binary. Even though some packages use it, your source code should not be stored in /usr/src as that is designated for system software such as the kernel.

Ensure your locations is found by PATH

Finally, you need to ensure that your installation location is included in your $PATH. If you decide to install your package in /opt but it's not in your $PATH your shell won't find the executables and you will have to use the absolute path to invoke your programs. Here are some great discussions from AU about configuring your $PATH

Additional reading: man hier


The Linux Standard Base and the Filesystem Hierarchy Standard are arguably the standards of where and how you should install software on a Linux system. I would suggest placing software that isn't included in your distribution either in /opt or /usr/local/ or rather subdirectories therein (/opt/<package> /opt/<provider> /usr/local/bin).

Best practice is to convert software you download to an installable software package native to your distribution, for instance dpkg or rpm formats. That will facilitate reporting, upgrading and cleanly removing the software.

  • 5
    This pretty much just re-states the question rather than answering it. The OP was aware that /opt and /usr/local/ were the two available options but wanted specific information on which one of those options to use. This could be a valid answer if it instead made a claim that the two locations are interchangeable (although I would dispute that it would be a correct answer in such case).
    – JBentley
    Feb 15, 2019 at 17:13
  • Is there any specific way to create a installable software package from the software I download (tar.gz) ? Jul 12, 2021 at 12:31


This is defined in systemd's standard which has the following to say about the directory's contents:

Executables that shall appear in the user's $PATH search path. It is recommended not to place executables in this directory that are not useful for invocation from a shell; these should be placed in a subdirectory of ~/.local/lib/ instead. Care should be taken when placing architecture-dependent binaries in this place, which might be problematic if the home directory is shared between multiple hosts with different architectures.

Depending on your distribution, you might have to add the directory to your path by putting this in your ~/.bashrc:


See also: Which distributions have $HOME/.local/bin in $PATH?

  • Only issue with this is that it is on a user base and therefore doesn't apply for when one needs a system-wide install.
    – domsson
    Apr 21, 2022 at 6:59
  • @domsson: Right, when you want to install software for all users, you'd use something different, like /usr/local/bin. I encountered the situation more often where I wanted to add software just for my user (also because I'm the only person using that machine). Since ~/.local/bin is user-writable whereas /usr/local/bin is not (at least on Arch), this was the more convenient option for me. Apr 21, 2022 at 14:19
  • in some cases when the app is an entire folder, I would use ~/.local/src/programfolder and make the appropriate call in a .desktop file in ~/.local/share/applications
    – Ferroao
    May 11, 2023 at 4:03

Binaries go in the bin folder by common conventions, how you would organize your package structure is up to you, I can think of /opt/<prog_name>/ if it is just a list of binaries.

  • I am afraid that Team Speak 3 guys made the program in such a way that everything it needs sits just in one folder (binaries,config files, logs), so It doesn't use /bin or /etc or /var/log
    – Eiver
    Apr 29, 2014 at 11:36

I had the same question while installing Eclipse via the Eclipse installer.

I noticed that Gimp, Perl and Vim are installed in the /usr/share folder and decided to install it there.

  • I suppose some auxiliary files may have been installed under that path, but the executables would be found in a bin directory.
    – Kusalananda
    Jan 4, 2023 at 7:51

There are two ways programs can be installed, depending on how they are packed.

  1. Via the software manager (apt, synaptic, Gdebi etc.) – the program is in a form of package, usually .deb or rpm. Software managers in most cases handles dependencies and will install binaries usually into /usr/bin, config files into /etc and so on. They may also create a config file for the program in your home, usually ~/.foo. If you can edit this file, you can also easily change settings for your session this way. When you remove the package, the manager will find all the files and cleanly remove them (it stored all the locations in a special text file). But it may preserve some config files, for example the one in your home folder.

  2. You download a program (usually compressed) in a form of pre-compiled binary files for your architecture. The executable file of the program is usually in a single folder next to other files (dynamically linked libraries etc.) This whole folder can be copied, with root privileges, either to /opt or /usr/bin and could, if permissions allow, be used by any user. I myself put the folders with binary files into my home folder to ~/bin. Now you should be able to run the program by invoking its bin file.


Don't use any of the pre-existing OS directories like usr. There is no well-defined standard which other people hold to consistently, and so:

  • you'll end up having to track many, many poorly-named locations,
  • you'll run into situations where it's ambiguous where you should store your program (as evidenced by the popularity of this question and complexity of its answers), and
  • programs you deliberately installed will share a directory with ones that other people/programs installed, or which came with the OS, with no easy way for you to distinguish which is which

Instead, use something simply-named in your native natural language, like ~/programs or ~/apps.

  • 1
    This is not Linux, think you're on MacOS.
    – stoney
    Jan 4, 2023 at 9:07
  • @stoney you don't know how to create a directory on Linux?
    – iono
    Jan 5, 2023 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .