LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to find installation directory for a certain program? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-installation-directory-for-a-certain-program-4175586500/)

pstein 08-07-2016 11:02 AM

How to find installation directory for a certain program?
 
Assume someone installed a program somewhere in the past in a possibly non-default program directory.

Even worse: several other versions of the same program might exist (in different directories) on the local computer as well.

So when I type at the terminal:

myfoobarprog

one of these programs is called.

How do I find out the installation directory of the program with the highest priority (among the duplicates)?

Is there a command like:

showinstallationpath -prog=myfoobarprog

tshikose 08-07-2016 11:13 AM

which myfoobarprog

tshikose 08-07-2016 11:14 AM

to find the installer package (at least on rpm based distro)
rpm -qf $( which myfoobarprog )

Shadow_7 08-07-2016 12:33 PM

You can list the contents of a .deb with:
$ dpkg -c package.deb

You can extract to a subdirectory with:
$ dpkg -x package.deb ./path/

You can use strings on the executable to discover any special paths. Which you might also need to run on anything that it loads.

$ strings $(which myfoobarprog)

$ strace myfoobarprog | grep -i open

Although the only way to "know" where it got installed is to have the thing that was installed in a state that it was when it was installed. Some of them even make it easy with an install.log and config.log. Although many are more primitive and need closer inspection. If you know "when" it was installed, you can sometimes use find to locate the files with similar timestamps. But that's more of a I don't have any clue, throw me a bone method.

John VV 08-07-2016 06:13 PM

Quote:

Assume someone installed a program somewhere in the past in a possibly non-default program directory.

Even worse: several other versions of the same program might exist (in different directories) on the local computer as well.

fire the administrator ASAP!
Then reinstall the OS ( who knows what other TIME BOMBS EXIST!!!)

that should NEVER happen

now

two or more different versions of software CAN be installed
BUT
precautions need to be taken
( or build the code to be installed SIDE by SIDE like gcc)

chrism01 08-07-2016 08:16 PM

As above, this
Code:

which myfoobarprog
will show you which (sic) exe is being called first.

To find them all,
Code:

find / -name myfoobarprog -type f

DavidMcCann 08-08-2016 10:37 AM

There's also the command whereis.

keefaz 08-08-2016 10:51 AM

Quote:

Originally Posted by tshikose (Post 5587401)
which myfoobarprog

Code:

which -a myfoobarprog

Habitual 08-08-2016 11:08 AM

Quote:

Originally Posted by Shadow_7 (Post 5587424)
You can list the contents of a .deb with:
$ dpkg -c package.deb

You can extract to a subdirectory with:
$ dpkg -x package.deb ./path/

You can use strings on the executable to discover any special paths. Which you might also need to run on anything that it loads.

$ strings $(which myfoobarprog)

$ strace myfoobarprog | grep -i open

You so Rock!

Quote:

Originally Posted by pstein (Post 5587399)
Assume someone installed a program somewhere in the past in a possibly non-default program directory.

I can assume from your assumption is that you don't know how to use find. ;)
Code:

find / -name myfoobarprog -type d

chrism01 08-09-2016 12:10 AM

Quote:

Assume someone installed a program somewhere in the past in a possibly non-default program directory.
which is why I used '-type f' ;)


All times are GMT -5. The time now is 02:43 AM.