Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

version of service

Posted on 2011-09-29
13
Medium Priority
?
397 Views
Last Modified: 2012-06-21
hello there,
there is a service installed on centos v5.6 64bit
I would like to see the version and if its 64bit.. how can I do that?
0
Comment
Question by:XK8ER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 
LVL 38

Accepted Solution

by:
wesly_chen earned 2000 total points
ID: 36818548
rpm -q --qf  "%{n}-%{v}-%{r}.%{arch}\n"  <package name>
<package name>.x86_64

or
echo  '%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}'  >> ~/.rpmmacros
then do
rpm -q <package_name>
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818552
For example:
$ rpm -q --qf "%{n}-%{v}-%{r}.%{arch}\n" vim-common
vim-common-7.0.109-3.el5.3.x86_64
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818654
Wesly,

Curious, why all extra formatting stuff?  I have never seen it done that way, just wondering what the reason is behind it.

If you know for example the name of the init script, you can just do
rpm -qf filename

Open in new window

[root@broken ~]# rpm -qf /etc/init.d/httpd
httpd-2.2.15-5.el6.centos.x86_64

Open in new window

0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818679
You have the setting in ~/.rpmmacros to show %%{arch} as I mentioned in the first post.
Otherwise, you won't see .x86_64
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818688
[root@broken ~]# cat ~/.rpmmacros
cat: /root/.rpmmacros: No such file or directory
[root@broken ~]# locate .rpmmacros
[root@broken /]# find . -name .rpmmacros -type f
[root@broken /]#

0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818702
[root@broken rpm]# pwd
/usr/lib/rpm
[root@broken rpm]# head macros
#/*! \page config_macros Default configuration: /usr/lib/rpm/macros
# \verbatim
#
# This is a global RPM configuration file. All changes made here will
# be lost when the rpm package is upgraded. Any per-system configuration
# should be added to /etc/rpm/macros, while per-user configuration should
# be added to ~/.rpmmacros.

Open in new window

0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818703
which Linux distribution do you have?
I tested on my CentOS 5.x.
Without setting in rpmmacros, it won't show %%{arch} by default.
--------
# cat ~/.rpmmacros
%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}

# mv /root/.rpmmacros   /root/.rpmmacros_old

#  rpm -qf /etc/init.d/httpd
httpd-2.2.3-53.el5.centos.1

# mv /root/.rpmmacros_old   /root/.rpmmacros

#  rpm -qf /etc/init.d/httpd
httpd-2.2.3-53.el5.centos.1.i386
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818707
CentOS 6

I don't recall having to do that on 5.x either... let me check some RHEL5's at work
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818718
On CentOS 5.x
# grep query_all_fmt  /usr/lib/rpm/macros
%_query_all_fmt         %%{name}-%%{version}-%%{release}
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818771
[user@phx1mmail1 ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[user@phx1mmail1 ~]$ grep query_all_fmt /usr/lib/rpm/macros 
%_query_all_fmt  %%{name}-%%{version}-%%{release}

Open in new window

[root@broken rpm]# grep query_all_fmt macros
%_query_all_fmt         %%{nvra}
[root@broken rpm]# grep nvra !$
grep nvra macros
%_query_all_fmt         %%{nvra}
[root@broken rpm]# cat /etc/redhat-release
CentOS Linux release 6.0 (Final)

Open in new window


Not sure what nvra is, and I'm not doing the research right this sec... stupid busy day at work... I hate computers ;)




Always learn new stuff on EE ;)
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36818783
> what nvra is
Name Version Release Arch
new stuff in RHEL6.x
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36818802
> what nvra is
Name Version Release Arch
new stuff in RHEL6.x

Hah.. duh... in hindsight that seems so obvious.  I'm definitely burnt out for the day...
0
 
LVL 1

Author Comment

by:XK8ER
ID: 36818824
wonderful.. thanks so much!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question