- Where is installed software stored in Linux?
- Solution 2
- Solution 3
- Solution 4
- Solution 5
- Where does apt-get install packages to?
- Ubuntu Filesystem Layout
- Package Management
- How does apt-get work?
- Additional Information
- Conclusion
- About the author
- Zeeman Memon
- Where is Ubuntu storing installed programs?
- 8 Answers 8
Where is installed software stored in Linux?
Many programs (the binaries/scripts) end up in /bin or /usr/bin with other parts in various configuration directories (often in/under etc ) as you already noted.
For any specific command you can checkout whereis
and it will give you some information about where this command is to be found. You can also try which
Solution 2
Under Windows, particularly older versions, it was common for programs to store configuration files and non-constant data in their C:\Program Files directory. This is derived from how programs were usually installed and ran under single-user, non-networked, non-file-permission DOS.
From a security standpoint, this is a bad idea. Places where executable code lives should be separated from modifiable data. That way it’s easier to apply appropriate file permissions to prevent modification of installed binaries by unauthorized users. Similarly library directories which may be updated separately from main executables should also be in a separate directory.
With the advent of Vista and UAC annoyances, this tradition is finally starting to seriously lose traction.
UNIX, and Linux, being a multiuser system from much earlier on, had the tendency to separate executable directories from other directories much earlier, since there was a need to prevent users other than root from modifying installed binaries. It’s also why /usr and even /sbin are sometimes separate partitions — a particularly security conscious admin can mount those partitions readonly and remount them read/write when an install/uninstall needs to happen.
Packages are usually installed from a package manager. There’s various package managers, such as aptitude (Debian and derived distributions), yum (Redhat and derived distributions), pacman (forget which distro this is. ), and others.
The package manager lets you browse repositories, download, install, query, and remove software, much like a sophisticated (and free) «app store.» It assumes responsibility for ensuring dependencies are taken care of and tracking what is currently installed.
Usually the package manager will also allow the same operations on a package you downloaded manually outside of any repositories. Tools are also available if you want to create your own from software you made or compiled yourself.
Since the package itself is NOT an executable file, you don’t have to run an untrusted executable which you don’t really know what it does. (Windows is finally coming around with updates by distributing .msu ‘s instead of .exe ‘s — but .msi ‘s have been around a while. )
Solution 3
You can get a list of the files that a given yum package installs by doing:
Then you can run it like so:
(Obviously, replace «yum-utils» in that second one with the name of that package whose file list you’d like to see.)
Solution 4
In Linux/Unix most programs don’t usually end up in a single directory, but different parts of it (executables, configuration files, log files, documentation, other resources) are scattered through the filesystem — usually through symlinking. The Wikipedia article describes in more detail the standard directory structure under a normal filesystem hierarchy, showing the different directories and what you can expect to find in each.
Solution 5
Typically under /usr/bin , although it depends on the particular application or library you’re installing.
Where does apt-get install packages to?
Whether you are a Linux veteran or just starting with Linux, you must have used apt-get or seen it being used somewhere. It is the primary way to install packages and dependencies on Ubuntu. In simpler terms, apt-get is the go-to of every Linux user when looking to set up software on their computer. This gives rise to a new question – where does apt-get install these packages to? Where do the files go, and how can one access them? In this guide, we will find out the answers to these questions.
Ubuntu Filesystem Layout
Before we get into the technicalities of the matter, let us start by acquiring a basic understanding of the Filesystem Hierarchy Standard, shortly known as FHS. All Linux distributions get their directory structure and contents from Filesystem Hierarchy Standard. We will briefly go over some parts that are crucial to understanding where apt-get install packages are and why so.
FHS is not considered to be some authority on directory structure and contents for absolutely every Linux distribution, but it is generally the most common standard of file layout. All directories and files in FHS appear under ‘/’ – the root directory. Let’s take a look at some commonly used directories.
- /bin directory holds the primary command binaries.
- /dev directory contains device files.
- /etc directory has host-specific configuration files.
- /home folder contains the user’s personal settings and saved files.
A non-profit organization known as Linux Foundation maintains the Filesystem Hierarchy Standard, and the last update (version 3.0) was made on June 3, 2015.
Now that we have gotten a better understanding of how the general Linux filesystem is structured and how it operates, we are ready to learn how apt-get makes use of this very structure to install packages and dependencies.
Package Management
All operating systems and Linux distributions come with a package manager. These package managers are responsible for installing and removing software from the computer and maintaining them. They give the user more control over what kind of programs they wish to run on the system and make their installation possible.
In Ubuntu (and Debian), dpkg is the package manager that most people use. You can manage packages with .deb extensions through dpkg. Discussing this utility is pertinent to our subject since we will be using it to find apt-get installs packages. “Aptitude” is the more user-friendly way to use dpkg as it provides a front-end to the users. Let us look at how dpkg works in Ubuntu, its syntax, and how you can use it to find out where apt-get installs packages.
The general syntax of this command is as follows.
Another common method of using it is:
You can install a package on your Linux system by running the following simple dpkg command.
We will understand how one can use dpkg and apt-get to install packages and learn where the packages are installed in the following sections.
How does apt-get work?
By this point, we all know that apt-get can be used to install, remove, and upgrade Linux packages. We also learned that it serves as the front-end for dpkg, the native package management utility for Ubuntu and Debian. But how does it really work? And what happens to the files that are installed by it? Let’s find out!
Let us start by installing a test package called ack. For this purpose, we will use apt-get, and later we will trace the files installed by it to their specific locations.
Go ahead and start a new Terminal window through the Activities menu or pressing Ctrl + Alt + T on your keyboard. The next step is to make sure you have the multiverse repository added. Without that, you cannot install ack. You are, obviously, free to use any other package of your choice.
So, to add the repository, run the following command in the Terminal.
Once that is out of the way, we move on to installing the package.
(Note that instead of ack-grep, ack was installed. This is why we will be modifying the next commands we execute)
The installation will be complete within a few seconds. Having done that, we now investigate the package with the help of our package manager, dpkg. We will find out where the files of the package were installed and how to access them.
Recall the general syntax of the dpkg command that we described in the earlier sections. Here, we will be using a variation of that command to list the files in the installed package.
To list the contents of a package, we use the -L operator with the dpkg command. Run the command given below to see the files.
As you can see in the image, all the package manager installed files are shown along with their addresses on the computer.
In addition to that, some files are created or modified by pre/postrm and pre/postinstall scripts included in the installed package. You can view these scripts in the following directory.
Additional Information
Now that we have covered the meat of the tutorial, we will add some additional pieces of information for those that are curious about learning more.
Let’s say, for example, you want to use dpkg to extract all the files of a package in the current directory. You can do this by running the following simple command.
You can also get a hold of the files such as preinst, postrm, postinst, and more by the command given below.
This will extract said files into the current directory as well.
Conclusion
With that being said, we conclude this guide. We learned several things about apt-get today. We saw the Filesystem Hierarchy Standard, how the Ubuntu package manager works, and finally, how we can find where apt-get installs packages to.
About the author
Zeeman Memon
Hi there! I’m a Software Engineer who loves to write about tech. You can reach out to me on LinkedIn.
Where is Ubuntu storing installed programs?
I am using Ubuntu and when I click on a program to download Firefox asks me «What should firefox do with this file?» And in the «Open with» I would like to find a program «Package installer». The problem is — I don’t know where to look for. Where is the program stored (I installed it using Ubuntu Software Center)
8 Answers 8
They are usually stored in the following folders:
If you’re not sure, use the which command:
~$ which firefox /usr/bin/firefox
If you installed the package with the Ubuntu package manager (apt, synaptic, dpkg or similar), you can get information about the installed package with
Is it possible to do a search if I don’t know exact name of the program. i’m asking because the name of the program is «Package installer», therefore I tried with «package_installer», «package-installer», «package», and I can’t find it
dpkg -l lists all installed packages. You can use something like dpkg -l | grep package and than use dpkg -L
@Dantes If you write dpkg -L p and press tab, it will show you the name of packages that starts with p installed on your system.
for some applications, for example google chrome, they store it under /opt. you can follow the above instruction using dpkg -l to get the correct naming then dpkg -L to get the detail.
Just for an addition reference to the above answers. I can not use dpkg -L to find the correct path for cuda. See the results I got from dpkg -L
$ dpkg -L cuda /. /usr /usr/share /usr/share/doc /usr/share/doc/cuda /usr/share/doc/cuda/copyright /usr/share/doc/cuda/changelog.Debian.gz
the correct path is /usr/local/cuda
$ ll /usr/local | grep cuda lrwxrwxrwx 1 root root 8 Oct 20 18:45 cuda -> cuda-9.0/ drwxr-xr-x 15 root root 4096 Oct 20 18:44 cuda-9.0/
Btw, I did install cuda by the command of