LinuxQuestions.org
Register a domain and help support LQ
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 11-06-2014, 01:05 PM   #1
vipinsqa
Member
 
Registered: Oct 2014
Posts: 40

Rep: Reputation: Disabled
List of packages installed and their location.


Hi,

I would need a list of packages installed on linux host (Centos) and their corresponding install location. The output needs to be dumped to an output file.

I understand that the list of packages can be retrieved using "rpm -qa" command. However, not sure how can I retrieve the installation location along with the package name and dump together into a file.

Anyone has any idea how this can be achieved?

Please provide inputs.

Thanks.

Regards..!
 
Old 11-06-2014, 02:24 PM   #2
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,606

Rep: Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977Reputation: 977
i have seen this thread on some other forum, where you were told that:
a) it's not that simple
b) be more precise (what's a service?)
c) nobody's going to write that script for you

it seems you weren't happy being told that, and did not provide any additional (and, may i say, real) info, and the thread just died.

now you're trying it here again - twice in slightly different wording.
how many more times will you try? are you honestly hoping the answers will be any different?
 
Old 11-06-2014, 02:29 PM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,094

Rep: Reputation: 1515Reputation: 1515Reputation: 1515Reputation: 1515Reputation: 1515Reputation: 1515Reputation: 1515Reputation: 1515Reputation: 1515Reputation: 1515Reputation: 1515
Really not that difficult.
  • a list of packages installed on linux host:
Code:
rpm -qa
  • and their corresponding install location
Code:
rpm -ql packagename
  • output needs to be dumped to an output file
Code:
>> outputfile.txt
All together in a oneliner:

For Centos/RHEL:

Code:
for i in $(rpm -qa); do echo "Package $i" >> somefile.txt; rpm -ql $i >> somefile.txt; done
For debian:

Code:
for i in $(dpkg --get-selections | awk {'print $1'}); do echo "Package $i" >> somefile.txt; dpkg -L $i >> somefile.txt; done
Quote:
c) nobody's going to write that script for you
It's really not a script. You don't get too many people willing to write out an entire script,.. but writing out a quick oneliner shouldn't be much of a stretch.

Last edited by szboardstretcher; 11-06-2014 at 03:37 PM.
 
1 members found this post helpful.
Old 11-06-2014, 02:59 PM   #4
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,655
Blog Entries: 10

Rep: Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075Reputation: 2075
Quote:
Originally Posted by ondoho View Post
i have seen this thread on some other forum, where you were told that:
a) it's not that simple
b) be more precise (what's a service?)
c) nobody's going to write that script for you

it seems you weren't happy being told that, and did not provide any additional (and, may i say, real) info, and the thread just died.

now you're trying it here again - twice in slightly different wording.
how many more times will you try? are you honestly hoping the answers will be any different?
Apparently not...https://www.linuxquestions.org/quest...on-4175524294/ and now it's gone. Oh well that ends well.

Last edited by Habitual; 11-06-2014 at 03:33 PM.
 
Old 11-07-2014, 03:25 AM   #5
vipinsqa
Member
 
Registered: Oct 2014
Posts: 40

Original Poster
Rep: Reputation: Disabled
Dear szboardstretcher,

Thanks a lot for the revert. It worked for me.

Cheers!
 
  


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
how to save a list of installed packages and install these packages later mandavi Ubuntu 5 09-07-2009 12:36 PM
List of installed packages? parent's_basement Debian 6 04-29-2008 06:04 PM
Find location of packages previously installed with yum on fedora core 5 Tails and Link Linux - Newbie 8 04-30-2006 05:27 AM
list of installed packages jeff1500 Slackware 3 03-22-2004 05:52 PM


All times are GMT -5. The time now is 06:24 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