LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-23-2011, 07:45 PM   #1
maobin
Member
 
Registered: Feb 2011
Posts: 42

Rep: Reputation: 0
How to check for installed programs?


Hi,
I would like to know if there is other ways of checking what is installed in my RHEL other then using rpm -qa.

I realised that some programs like firefox that i dl from the firefox website and unzip to use does not appear in the results from rpm -qa.

Thanks in advance
 
Old 02-23-2011, 08:03 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Not without a fair bit of scripting ...
 
Old 02-23-2011, 08:06 PM   #3
maobin
Member
 
Registered: Feb 2011
Posts: 42

Original Poster
Rep: Reputation: 0
hmm.. can you roughly tell me what sort of action i should do for the script? i can try writing the script myself.
 
Old 02-23-2011, 08:08 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,938

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Check yum man pages.
 
Old 02-23-2011, 08:11 PM   #5
maobin
Member
 
Registered: Feb 2011
Posts: 42

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by michaelk View Post
Check yum man pages.
I need to check for those not installed by a package manager as well.. I dun think i can use yum for that. correct me if i'm wrong
 
Old 02-23-2011, 08:27 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
If you are going to bypass yum, what I do is create a separate dir for each d/l under /opt. Basically, it's up to you to be disciplined about where you store the orig d/l, irrespective of where it installs to.
If this is after the fact (& I don't have a Linux system to refer to in front of me), basically you'd have to write a script that checked all the obvious dirs eg /bin, /sbin etc and compared that to the output from yum.
You may need various yum options; look at these cmds: https://access.redhat.com/kb/docs/DOC-2531
 
Old 02-23-2011, 08:41 PM   #7
maobin
Member
 
Registered: Feb 2011
Posts: 42

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
If you are going to bypass yum, what I do is create a separate dir for each d/l under /opt. Basically, it's up to you to be disciplined about where you store the orig d/l, irrespective of where it installs to.
If this is after the fact (& I don't have a Linux system to refer to in front of me), basically you'd have to write a script that checked all the obvious dirs eg /bin, /sbin etc and compared that to the output from yum.
You may need various yum options; look at these cmds: https://access.redhat.com/kb/docs/DOC-2531
Ic, because I will need to know these information from many different machines and I have no control over where are the prog installed or placed in.

For your 2nd point abt the /bin and /sbin, they are locations where executable files are located right? when yum/rpm installs package the executable files will automatically be placed there right?
 
Old 02-23-2011, 08:46 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,938

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Indeed, yum will tell you what is installed vs what is available from the database. Anything installed from source yum or rpm would not be able to detect. I agree it would take a fair bit of scripting.

Just quickly brainstorming you could compare a list of all executables vs what is installed by yum or rpm. The difference would be those installed by source plus anything you have written yourself.

Last edited by michaelk; 02-23-2011 at 08:47 PM.
 
Old 02-23-2011, 08:51 PM   #9
maobin
Member
 
Registered: Feb 2011
Posts: 42

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by michaelk View Post
Indeed, yum will tell you what is installed vs what is available from the database. Anything installed from source yum or rpm would not be able to detect. I agree it would take a fair bit of scripting.

Just quickly brainstorming you could compare a list of all executables vs what is installed by yum or rpm. The difference would be those installed by source plus anything you have written yourself.
thanks for the advice, will try writing the script 1st.
 
Old 02-23-2011, 09:04 PM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
Rather crude first attempt but anyway:
Code:
# Top level directories to consider slash exlude:
for DIR in $(find / -maxdepth 1 -type d | egrep -v "(/$|root|lib|home|media\
|selinux|boot|dev|sys|proc|mnt|lost+|tmp|var|etc)" 2>/dev/null); do
 # in each directory DIR search (not IFS safe) for files with the executable bit set for the user:
 find "${DIR}" -type f -perm -u=x 2>/dev/null | while read FILE; do
  # then check if it's a script or binary or library (skipping text files, images, etc for speed)
  # and grep the RPMDB if file FILE is known
  file -i "${FILE}"|egrep -qie "(execu|scrip|libr)" && rpm -qf "${FILE}" 2>&1|grep owned
 done
done
 
Old 02-23-2011, 09:26 PM   #11
maobin
Member
 
Registered: Feb 2011
Posts: 42

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Rather crude first attempt but anyway:
Code:
# Top level directories to consider slash exlude:
for DIR in $(find / -maxdepth 1 -type d | egrep -v "(/$|root|lib|home|media\
|selinux|boot|dev|sys|proc|mnt|lost+|tmp|var|etc)" 2>/dev/null); do
 # in each directory DIR search (not IFS safe) for files with the executable bit set for the user:
 find "${DIR}" -type f -perm -u=x 2>/dev/null | while read FILE; do
  # then check if it's a script or binary or library (skipping text files, images, etc for speed)
  # and grep the RPMDB if file FILE is known
  file -i "${FILE}"|egrep -qie "(execu|scrip|libr)" && rpm -qf "${FILE}" 2>&1|grep owned
 done
done
Thanks alot for the code.. i'm rather new to linux and scripting so dun mind me asking
1) what is the ${}?
2) egreo -qiw "(execu|scrip|libr)" is it checking for lines that contains execu or scrip or libr?
 
Old 02-24-2011, 12:30 AM   #12
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7
Posts: 872

Rep: Reputation: 112Reputation: 112
rpm -qa just shows what rpm manages but if you install from source you have to know where its installed. If the source code was kept in a specific place then you would know where that is hopefully. Otherwise if you install from source and don't use package manager then you need to install in a specific prefix using the prefix flag while runing ./configure like ./configure --prefix=/usr/sbin. otherwise doing that is gets messy
 
Old 02-24-2011, 03:22 AM   #13
maobin
Member
 
Registered: Feb 2011
Posts: 42

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jmc1987 View Post
rpm -qa just shows what rpm manages but if you install from source you have to know where its installed. If the source code was kept in a specific place then you would know where that is hopefully. Otherwise if you install from source and don't use package manager then you need to install in a specific prefix using the prefix flag while runing ./configure like ./configure --prefix=/usr/sbin. otherwise doing that is gets messy
Like i said previously, i can't control how a prog is installed in a machine as i will be running my script on different machines used by different people. Thanks for the advice anyway
 
  


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
install packages & check the list of installed programs/languages/applications shojaru Linux - Newbie 2 05-22-2009 03:36 AM
how to check installed programs in linux? int21h Linux - Newbie 3 05-20-2007 10:47 PM
Programs installed with package manager aren't recognised by other programs fraserm Linux - Software 3 04-21-2007 01:38 PM
How to get newly installed programs in programs list Brosky Linux - Software 5 02-06-2004 04:45 PM
SaTaN please 3 programs to check bprasanth_20 Programming 9 10-20-2003 12:41 PM


All times are GMT -5. The time now is 04:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration