What is the Linux equivalent to C:\Program Files?
I understand that in Windows as well as Linux and Unix, a program|application|software can be installed in any directory. Also if packages are installed using the distribution’s packaging system, it’ll place files in the correct location. But at times, a software installation prompts for a path to place files. In case of a Linux distro where is this default place ( C:\Program Files or C:\progra~1 equivalent)? Is it different for various distributions? If yes, where would this be for RHEL , Suse and Ubuntu ?
7 Answers 7
The Linux Documentation Project has a description of the Linux filesystem hierarchy where they explain the different folders and their (partly historical) meaning.
As xenoterracide already pointed out /bin and /opt are the standard directories which can be compared to «Program Files» on Windows.
/bin contains several useful commands that are of use to both the system administrator as well as non-privileged users. It usually contains the shells like bash , csh , etc. and commonly used commands like cp , mv , rm , cat , ls .
/opt is reserved for all the software and add-on packages that are not part of the default installation. For example, StarOffice, Kylix, Netscape Communicator and WordPerfect packages are normally found here.
Isn’t /opt only used for packages that are not contained in the repos? The application folders for inkscape, gimp, rhythmbox etc. are located in /usr/share. Wouldn’t that rather be the equivalent?
See linuxfoundation.org/en/FHS for more recent info on the filesystem hierarchy (FHS). (Note: The site is down at the moment but should be back up shortly).
@Toxicbits: At least on Gentoo in /opt there are binary packages — especially those which cannot be installed to /usr due to nonstandard filesystem hierarchy.
TLDP seems great! Well, on a side note; the first time I saw TLDP, I thought: «too long didn’t. peak? what?»
This is incorrect. /bin contains only executable programs. The Windows Program Files directory contains a subdirectory for each installed application, which contains all of the executables, dlls, data files, and everything else needed by / shipped with the application.
There is no direct equivalent. The directory structure is very different. Under Windows, you have a single directory for each installed package/software that contains all the files related to (e.g. C:\Program Files\MyProgram ). Under Linux each software is «dispersed» in many directories according to file type and some other rule.
As an example, we can examine where different files related to xscreensaver program are installed:
/etc/pam.d/xscreensaver /etc/xscreensaver /etc/xscreensaver/README /usr/bin/xscreensaver /usr/bin/xscreensaver-command /usr/bin/xscreensaver-demo /usr/bin/xscreensaver-gl-helper /usr/share/X11/app-defaults/XScreenSaver /usr/share/applications/xscreensaver-properties.desktop /usr/share/doc/packages/xscreensaver /usr/share/doc/packages/xscreensaver/README /usr/share/locale/ca/LC_MESSAGES/xscreensaver.mo /usr/share/locale/da/LC_MESSAGES/xscreensaver.mo /usr/share/locale/de/LC_MESSAGES/xscreensaver.mo [ . ] /usr/share/locale/zh_TW/LC_MESSAGES/xscreensaver.mo /usr/share/man/man1/xscreensaver-command.1.gz /usr/share/man/man1/xscreensaver-demo.1.gz /usr/share/man/man1/xscreensaver.1.gz /usr/share/man/man6/xscreensaver-gl-helper.6x.gz /usr/share/pixmaps/xscreensaver.xpm /usr/share/xscreensaver /usr/share/xscreensaver/glade /usr/share/xscreensaver/glade/screensaver-cmndln.png /usr/share/xscreensaver/glade/screensaver-colorselector.png [ . ]
Do not worry, usually when a installer asks where to install to, the correct answer is one of the following: / , /opt , /usr , /usr/local
As you can see, quite all(1) files of xscreensaver are installed under /usr according to some simple rule: executables in /usr/bin , manual pages in /usr/share/man , documentation in /usr/share/doc/packages/PROGRAMNAME and so on.
When an installer asks for a installation prefix , usually it wants to now the base path under which install the program. In my xscreensaver example, it is /usr .
As simple rule: / should contain only program that are needed to boot the system (as C:\windows\system32 ), /usr/local should contain the programs that are needed only on that unique computer, /opt (2) all the optional programs that have non standard directory structure and /usr all the standard software.
In any case, it exists a standard that defines all these rules in detail: Filesystem Hierarchy Standard
(1) system-wide configuration files must reside in /etc
(2) quite obsolete under Linux
Where are the «program files» in Debian?
I’m new to Linux and not really sure how the file system works. When you install a program in Windows, it stores the program’s files in the Program Files folder and creates an icon in the Start menu. If I want to create an icon myself, I just search for the exe, as there is usually only one exe file with the program name, and I create a shortcut to launch it. Could someone explain me what happens when I install a program on Linux? (by running a .deb file) Where does it store the program’s files, how can I identify the file I have to run to start the application, and how do I create a shortcut to run it?
Here is a question I remembered regarding linux shortcuts. It may have some info for you. superuser.com/questions/310498/…
Checking the content of the deb file helps if you can’t find the bianry to launch the program, use «dpkg -c example.deb» to list the destination of each files in it.
2 Answers 2
When you install new programs in *.deb format the synaptic package manager will run a dependency check and install all required files in the package to your system. Depending on what kind of package it is and what type of files it has, the files will be placed in different directories. To see where the different files reside in your filesystem after installation, you can open synaptic and right-click the package + details to see what files are in it. Executable files in a package often reside in directories with bin in their path e.g. /bin , /usr/bin , /usr/local/bin , /usr/local/sbin , /usr/sbin where / means the root directory — the parent to all directories in your filesystem.
Inspect your environmental PATH variable on what directories are searched for executables whenever you execute a program. Start a terminal with Alt+F2 and type in xterm , hit Enter and issue:
To create a shortcut launcher for the installed application, make sure it has an associated *.desktop file, usually residing in /usr/share/applications/ . You should then be able to right-click your desktop and select something like «create launcher», providing the path to the application if it’s not in the list.
Where can I find the location of folders for installed programs?
I’m new to Ubuntu and would like to know where I can find the location of program files for programs installed from the Ubuntu Software Center or the Terminal.
If you prefer/use RPM on Ubuntu, you can also use rpm –ql [package] to get a list. This method also happens to work on most Fedora and RHEL distros.
8 Answers 8
Also, if you just need to know where the executable is you can run whereis executable or which executable For instance:
$ whereis firefox firefox: /usr/bin/firefox /etc/firefox /usr/lib/firefox /usr/share/man/man1/firefox.1.gz $ which firefox /usr/bin/firefox
on the command line, you can use dpkg —listfiles packagename . For instance, dpkg —listfiles firefox . If you want to see what files a package contains without installing it, then you can install apt-file and use that.
But you really shouldn’t mess with it. There is usually no reason to manually interfere with the contents of a package. All configuration files for normal applications are placed in the users home directory. You don’t have savegames in C:\Programfiles\Appname\savegames , for instance. They would be placed in /home/username/.local/share/appname/savegames . That way, if you move your home directory to another machine, it keeps all configurations and user data.
This command says «package ‘sdl’ is not installed»; But this command: «dpkg —get-selections | grep sdl» returned : libsdl-image1.2:amd64 install —- libsdl1.2debian:amd64 install —- libsdl2-2.0-0:amd64 install —- libsdl2-dev install
The OP wants to know where the installation directory containing the app files is located. He did not ask for a list of files in a package.
@HedleyFinger: There is no such thing as the «installation directory». Each app has files stored in many different directories for different types of files. /etc for default configs, /usr/bin for binaries, /usr/lib for libraries, etc. The command I showed, shows where all app files are installed.
If you do not find the command with whereis or which then maybe it is an alias. Try
and check if the command is in the list.
Use the synaptic-package-manager :
Assuming that we’d like to locate the files of the autotools-dev package, under ‘Quick filter’ enter autotools to locate it. The autotools-dev package appears automatically. Select it by clicking on it and then press ‘Properties’. In the appearing dialog select the tab ‘Installed Files’.
The builtin Bash command, called command is also available:
command [-pVv] command [arguments …]
$ command -V cat cat is /bin/cat
When the searched command is an alias:
$ command -v ll alias ll='ls -alF'
$ command -V ll ll is aliased to `ls -alF'
Coming to Linux from Windows, there are some different terminology, which sometimes seems strange.
The first one is the word package that we find on Linux. We install packages on Linux, which may sound different but makes total sense:
- When installing something on the computer, we are installing programs like in your question, but also configuration files, images, documentation, etc. Sometimes we are even installing, in one package, many programs
One example for you, i was looking for installing a package called bluez-tools in Lubuntu 22.04. In your terminal:
sudo apt install bluez-tools
After installing it, the question is, how to use this bluez-tools stuff i have installed. Then we have the answer to your question, we have to look for what and where we have just installed the package in our system.
The following command gives you some information about the package you just installed.
dpkg -l bluez-tools ii bluez-tools 2.0~20170911.0.7cb788c-4 amd64 Set of tools to manage Bluetooth devices for linux
And this other command shows what and where things were installed
dpkg -l bluez-tools /. /usr/bin /usr/bin/bt-adapter /usr/bin/bt-agent /usr/bin/bt-device /usr/bin/bt-network /usr/bin/bt-obex /usr/share /usr/share/doc /usr/share/doc/bluez-tools /usr/share/doc/bluez-tools/README /usr/share/doc/bluez-tools/changelog.Debian.gz /usr/share/doc/bluez-tools/copyright /usr/share/man /usr/share/man/man1 /usr/share/man/man1/bt-adapter.1.gz /usr/share/man/man1/bt-agent.1.gz /usr/share/man/man1/bt-device.1.gz /usr/share/man/man1/bt-network.1.gz /usr/share/man/man1/bt-obex.1.gz
It can be seen the package contains 5 programs, some docs, and five manual pages.