LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-07-2016, 11:02 AM   #1
pstein
LQ Newbie
 
Registered: Jan 2009
Posts: 13

Rep: Reputation: 0
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
 
Old 08-07-2016, 11:13 AM   #2
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 347

Rep: Reputation: 68
which myfoobarprog
 
1 members found this post helpful.
Old 08-07-2016, 11:14 AM   #3
tshikose
Member
 
Registered: Apr 2010
Location: Kinshasa, Democratic Republic of Congo
Distribution: RHEL, Fedora, CentOS
Posts: 347

Rep: Reputation: 68
to find the installer package (at least on rpm based distro)
rpm -qf $( which myfoobarprog )
 
1 members found this post helpful.
Old 08-07-2016, 12:33 PM   #4
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 2,596
Blog Entries: 1

Rep: Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511Reputation: 511
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.
 
Old 08-07-2016, 06:13 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,020

Rep: Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455Reputation: 2455
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)

Last edited by John VV; 08-07-2016 at 06:16 PM.
 
Old 08-07-2016, 08:16 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,295

Rep: Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358
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
 
Old 08-08-2016, 10:37 AM   #7
DavidMcCann
Senior Member
 
Registered: Jul 2006
Location: London
Distribution: CentOS, Salix
Posts: 4,308

Rep: Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294Reputation: 1294
There's also the command whereis.
 
Old 08-08-2016, 10:51 AM   #8
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,388

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
Originally Posted by tshikose View Post
which myfoobarprog
Code:
which -a myfoobarprog
 
Old 08-08-2016, 11:08 AM   #9
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 7,818
Blog Entries: 11

Rep: Reputation: 2104Reputation: 2104Reputation: 2104Reputation: 2104Reputation: 2104Reputation: 2104Reputation: 2104Reputation: 2104Reputation: 2104Reputation: 2104Reputation: 2104
Quote:
Originally Posted by Shadow_7 View Post
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 View Post
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

Last edited by Habitual; 08-08-2016 at 11:10 AM.
 
Old 08-09-2016, 12:10 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,295

Rep: Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358
Quote:
Assume someone installed a program somewhere in the past in a possibly non-default program directory.
which is why I used '-type f'
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Howto find installation directory for FlightGear -- can't be too hard, surely? pierssnell Linux - Newbie 3 10-28-2011 06:32 PM
Find directory older than x and mv directory with sub files command ajhart Linux - Newbie 4 07-15-2011 05:24 AM
[SOLVED] can't find program, though its directory appears to be in the path kolotila Linux - Enterprise 8 07-02-2010 01:52 PM
How are binary program files placed into a directory for installation? devonto Linux - Newbie 2 12-15-2006 09:26 AM
Where to find a program after it installation ibou Fedora 4 11-08-2004 04:39 AM


All times are GMT -5. The time now is 01:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration