LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 12: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, 01:24 PM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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, 01:29 PM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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 02:37 PM.
 
1 members found this post helpful.
Old 11-06-2014, 01:59 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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 02:33 PM.
 
Old 11-07-2014, 02: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



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 11:36 AM
List of installed packages? parent's_basement Debian 6 04-29-2008 05:04 PM
Find location of packages previously installed with yum on fedora core 5 Tails and Link Linux - Newbie 8 04-30-2006 04:27 AM
list of installed packages jeff1500 Slackware 3 03-22-2004 04:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:32 PM.

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
Open Source Consulting | Domain Registration