What's the equivalant of c:\program files\ in Linux?

Red Squirrel

No Lifer
May 24, 2003
70,108
13,550
126
www.anyf.ca
Often I'm in a situation where I get an open with dialog, but I have no clue where to even start because I don't know where the "exe" files are. For example at random, PDFs want to open with Gimp instead of the PDF reader. How do I find the PDF reader?
 

mv2devnull

Golden Member
Apr 13, 2010
1,526
160
106
On the path, usually.

The approach is different. Windows applications have everything in one folder.

Linux applications tend to place:
binary to prefix/bin (and prefix/bin should be on the PATH)
libraries to prefix/lib or prefix/lib64
configuration to prefix/etc
other data to prefix/share/programname

Source installs should not use the same prefix as the managed packages do.

(OS X does use one folder per app, but different files will be in systematically named subfolders of the 'programname.app' "bundle".)
 

theevilsharpie

Platinum Member
Nov 2, 2009
2,322
14
81
Linux doesn't have a direct equivalent of Windows' Program Files[1], because Linux has a very different philosophy in how file systems should be organized.

Executable files in Linux are stored in a number of different paths for primarily historical reasons, but something like a PDF viewer is probably going to be in /usr/bin (if you installed it with your distro's package manager), or /usr/local/bin (if you've compiled and installed it yourself). If you're curious about which directories your distro will look at to find executable files, run echo $PATH in a terminal.

For a PDF viewer in particular, if you're running GNOME or a GNOME-based desktop environment, you're probably using Evince. If you're running KDE, you're probably using Okular. If you're not sure what you're running, you can search through your distro's package manager for installed packages in a particular category, or you can search your man pages with the apropos command to see which (if any) contain the keyword that you're looking for. When you do find the name of your executable, you can find its path with the which command.

That being said, most desktop environments present the contents of the application menus when asking you which program you want to use to open a file, and most desktop applications will be in there someone.

[1]/opt kind of serves the same function as Program Files, but you won't find many open source applications that install there.
 

Scarpozzi

Lifer
Jun 13, 2000
26,391
1,780
126
Part of the problem is where programs used to run. It's made all the distros organize a little differently. Some variants of Linux and Unix follow different partition/directory structures.

/usr used to be short for USER which is where user applications and space were. This has been replaced with /home for home folders on most linux variants, but you can still find many system applications there. /usr/sbin is where a lot of the utilities are stored for user or partition management, for instance.

When applications unpackage, they are set to install in various locations. The best way to *track them is to figure out where they execute from. If they're services, you can track them by looking at /etc/init.d/ and the service startup scripts. Trace that back to what is being executed and where. Often, environmental variables are set that the system follows and are referenced in these scripts.

/opt is used for a lot of 3rd party applications these days in the server world, but sometimes applications are nested too in lower directories and executed from /bin or ../../../bin way down the directory tree.

If you're looking for something in-particular, you can use find to search the file system. Open a terminal on the system in which you have gimp.
Type: find / -name gimp

My results on Xubuntu were:
/usr/lib/gimp
/usr/bin/gimp
/usr/share/doc/gimp
/usr/share/menu/gimp
/usr/share/gimp

You can guess that the executable or "EXE" equivalent is in /usr/bin and that the support files are in /usr/share/ and the /usr/share/doc /usr/share/menu directories.
 

Red Squirrel

No Lifer
May 24, 2003
70,108
13,550
126
www.anyf.ca
Sounds like it's a mess then. They should really move to a more consistent format and put everything in one folder. The biggest issue is I can't just right click and go properties on a shortcut like in windows, so is there a way I can tell where a particular program is based on a shortcut? Desktop shortcuts do have a properties option but not start menu ones.

Occasionally the open with dialog will have a list of apps, but other times it just drops me into a open file dialog where I'm left on my own to try to find the actual executable. It seems to depend in what situation it's invoked. (ex: web browser, or desktop) I don't even know what to search for, when I open a PDF it just opens (usually) so I don't know what it calls for that. I'm just using PDF as an example, I run into similar situation often enough with other file formats.

I found that it's Okular but just because it was mentioned here, how would I go about finding that on my own without having to google stuff, when I'm in a similar situation? Or is that the only way? Part of the issue is the obscure names lot of programs use and it seems to change all the time based on distro. There's no consistency.

So it's safe to say that all programs can be invoked directly as they are in the %path% then? Guess it at least gives me an idea were to look, but only if I know the name of the program.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
If you know the name of the executable use 'which' to show you the location.

Code:
$ which bash
/bin/bash

Code:
$ which firefox
/usr/bin/firefox

If you don't know the name of the executable, well just look it up with ps or top after you have the program running.
 

lxskllr

No Lifer
Nov 30, 2004
59,362
9,885
126
I kind of agree with you. I don't think it should be like Windows, but the file system could use some tidying up. A lot of the reason it's the way it is, is due to legacy reasons that don't matter anymore. Also, one of my big piss offs is generic names for software. I guess it helps people that don't know what things are, but that's what tool tips are for. I'm not interested in "web browser" or document viewer" I want Firefox and Evince. When you open the program, look in About, and it might give some clues. This is what those turds give me for "Document Viewer"...

R7v8ltF.png


Still requires more thinking and research than it should :^S
 

mv2devnull

Golden Member
Apr 13, 2010
1,526
160
106
Sounds like it's a mess then.
It is not a mess. It is systematic and intuitive. The location of a file tells about the purpose of the file. You want to find things from path and you don't want the path to be an enormous list. You are free to hole into single folder as long as you do provide symlinks (or redirect scripts) in expected locations.

The only problem are those application writers that don't bother to be systematic.

Some Desktop Managers provide "Preferred applications" wrappers, which show in menu "Web Browser" and "Mail Reader", and start whatever they are (somehow) set to start. IMHO, clickety clack GUI crap is free to rot.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,610
4,530
75
If you just want to look at a document, and let the OS worry about what program to use, try "see". "see my.pdf" is like "start my.pdf" on Windows. It's not perfect, but it's useful.