Linux - RPM Commands
Results 1 to 3 of 3

Thread: Linux - RPM Commands

  1. #1
    Senior Member
    Join Date
    May 2002
    Posts
    450

    Linux - RPM Commands

    From the onset I wish to point out that this is NOT my work, but something I found in the dark recesses of my hard drive today. I am posting it hopefully to assist anyone (in particular newbies), from a security point of view, running a RPM based Linux distro. It sets out a number of RPM commands which enable you to descend into those RPM packages to see what lurks there ....

    RPM COMMANDS

    - rpm help (short list)
    - rpm --help (long list)
    - man rpm
    - info rpm
    - xman
    - KHelpcenter

    and...

    Can you create a file containing a sorted list of all installed packages ?

    [b@Ath1-1 b]$ rpm -qa | sort > sorted_list_all_packages

    Can you display this last file in columns ?

    (larger terminal window needed)

    [b@Ath1-1 b]$ cat sorted_list_all_packages | column

    What installed package names contain the word rpm ?

    Sorted list in columns please.
    (cut/paste from konsole to kedit != tabs ?)

    [[b@Ath1-1 b]$ rpm -qa | grep rpm | sort | column
    gnorpm-0.95.1-1mdk rpmlint-0.24-1mdk
    grpmi-7.2-19.1mdk rpm-python-3.0.5-25mdk
    gurpmi-0.7-10mdk rpm-rebuilder-0.1-1mdk
    rpm-3.0.5-25mdk rpmtools-1.2-11mdk
    rpm-build-3.0.5-25mdk rpmtools-compat-1.2-11mdk
    rpm-devel-3.0.5-25mdk rpmtools-devel-1.2-11mdk
    rpmdrake-1.1-15mdk urpmi-1.3-10mdk

    How many listed packages are there ?

    [b@Ath1-1 b]$ rpm -qa | grep rpm | wc -l
    14

    What about RpM ?

    [b@Ath1-1 b]$ rpm -qa | grep -i RpM | sort | column
    gnorpm-0.95.1-1mdk rpmlint-0.24-1mdk
    grpmi-7.2-19.1mdk rpm-python-3.0.5-25mdk
    gurpmi-0.7-10mdk rpm-rebuilder-0.1-1mdk
    perl-RPM-0.28-2mdk rpmtools-1.2-11mdk
    rpm-3.0.5-25mdk rpmtools-compat-1.2-11mdk
    rpm-build-3.0.5-25mdk rpmtools-devel-1.2-11mdk
    rpm-devel-3.0.5-25mdk urpmi-1.3-10mdk
    rpmdrake-1.1-15mdk

    How many listed packages are there ?

    [b@Ath1-1 b]$ rpm -qa | grep -i RpM | wc -l
    15

    BACK TO RPM DOCUMENTATION !

    What documentation files are in rpm-3.0.5-25mdk ?

    [b@Ath1-1 b]$ rpm -qd rpm-3.0.5-25mdk
    /usr/share/doc/rpm-3.0.5/CHANGES
    /usr/share/doc/rpm-3.0.5/GROUPS
    /usr/share/doc/rpm-3.0.5/RPM-PGP-KEY
    /usr/share/doc/rpm-3.0.5/buildroot
    /usr/share/doc/rpm-3.0.5/dependencies
    /usr/share/doc/rpm-3.0.5/format
    /usr/share/doc/rpm-3.0.5/macros
    /usr/share/doc/rpm-3.0.5/multiplebuilds
    /usr/share/doc/rpm-3.0.5/queryformat
    /usr/share/doc/rpm-3.0.5/relocatable
    /usr/share/doc/rpm-3.0.5/signatures
    /usr/share/doc/rpm-3.0.5/spec
    /usr/share/doc/rpm-3.0.5/triggers
    /usr/share/man/ja/man8/rpm.8.bz2
    /usr/share/man/ja/man8/rpm2cpio.8.bz2
    /usr/share/man/man1/gendiff.1.bz2
    /usr/share/man/man8/rpm.8.bz2
    /usr/share/man/man8/rpm2cpio.8.bz2
    /usr/share/man/man8/update-alternatives.8.bz2
    /usr/share/man/pl/man8/rpm.8.bz2
    /usr/share/man/ru/man8/rpm.8.bz2
    /usr/share/man/ru/man8/rpm2cpio.8.bz2

    How many files in rpm-3.0.5-25mdk ?

    [b@Ath1-1 b]$ rpm -ql rpm-3.0.5-25mdk | wc -l
    92

    Can you display only the first file in rpm-3.0.5-25mdk ?

    [b@Ath1-1 b]$ rpm -ql rpm-3.0.5-25mdk | head -n 1
    /bin/rpm

    Can you give me more details on this last one ?

    [b@Ath1-1 b]$ rpm -qlv rpm-3.0.5-25mdk | head -n 1
    -rwxr-xr-x root root 887912 Oct 9 2000 /bin/rpm

    Can you show me the install state of files for rpm-3.0.5-25mdk ?

    Only the last file in list please.

    [b@Ath1-1 b]$ rpm -qsv rpm-3.0.5-25mdk | tail -n 1
    normal drwxr-xr-x root root 4096 Oct 9 2000 /var/lib/rpm/alternatives

    How many non normal files are in rpm-3.0.5-25mdk ?

    [b@Ath1-1 b]$ rpm -qsv rpm-3.0.5-25mdk | grep -v -i normal | wc -l
    17

    Please display showing less information the last non normal file in rpm-3.0.5-25mdk

    [b@Ath1-1 b]$ rpm -qs rpm-3.0.5-25mdk | grep -v -i normal | tail -n 1
    not installed /usr/share/man/ru/man8/rpm2cpio.8.bz2

    What does rpm-3.0.5-25mdk require ?

    [b@Ath1-1 b]$ rpm -qv --requires rpm-3.0.5-25mdk
    gawk
    fileutils
    textutils
    sh-utils
    mktemp
    bzip2 >= 0.9.0c-2
    popt
    /bin/sh
    /sbin/ldconfig
    ld-linux.so.2
    libbz2.so.1
    libc.so.6
    libdb.so.2
    libz.so.1
    /bin/bash
    /bin/sh
    /usr/bin/perl
    libc.so.6(GLIBC_2.0)
    libc.so.6(GLIBC_2.1)
    libdb.so.2(GLIBC_2.0)

    Is gawk installed ?

    [b@Ath1-1 b]$ rpm -q gawk
    gawk-3.0.6-1mdk

    What package owns /bin/sh in --requires list ?

    [b@Ath1-1 b]$ rpm -qfv /bin/sh
    bash-2.04-12mdk

    What package(s) provide libc.so.6 in --requires list ?

    [b@Ath1-1 b]$ rpm -q --whatprovides libc.so.6
    compat-glibc-7.2-2.1.3.3mdk
    glibc-2.2.2-4mdk

    What does rpm-3.0.5-25mdk provide ?

    [b@Ath1-1 b]$ rpm -q --provides rpm-3.0.5-25mdk
    librpm.so.0
    librpmbuild.so.0

    Where is file librpm.so.0 ?

    [b@Ath1-1 b]$ rpm -qs rpm-3.0.5-25mdk | grep librpm.so.0
    normal /usr/lib/librpm.so.0
    normal /usr/lib/librpm.so.0.0.0
    or
    [b@Ath1-1 b]$ whereis -b librpm.so.0
    librpm.so: /usr/lib/librpm.so /usr/lib/librpm.so.0

    Is rpm-3.0.5-25mdk a package name ! ?

    [b@Ath1-1 b]$ rpm -q --queryformat "%{NAME}\\n" rpm-3.0.5-25mdk
    rpm

    What is it's version number ?

    [b@Ath1-1 b]$ rpm -q --queryformat "%{VERSION}\\n" rpm
    3.0.5

    What is it's release number ?

    [b@Ath1-1 b]$ rpm -q --queryformat "%{RELEASE}\\n" rpm
    25mdk

    What is it'patch level ?

    [b@Ath1-1 b]$ rpm -q --queryformat "%{PATCH}\\n" rpm
    (none)

    What is it's source ?

    [b@Ath1-1 b]$ rpm -q --queryformat "%{SOURCERPM}\\n" rpm
    rpm-3.0.5-25mdk.src.rpm

    When was package rpm installed ?

    [b@Ath1-1 b]$ rpm -q --queryformat "%{INSTALLTIME:date}\\n" rpm
    Sat Feb 3 18:05:23 2001

    Can you give me more information about package rpm ?

    [b@Ath1-1 b]$ rpm -qi rpm
    Name : rpm Relocations: /usr
    Version : 3.0.5 Vendor: MandrakeSoft
    Release : 25mdk Build Date: Mon Oct 9 05:28:51 2000
    Install date: Sat Feb 3 18:05:23 2001 Build Host: bi.mandrakesoft.com
    Group : System/Configuration/Packaging Source RPM: rpm-3.0.5-25mdk.src.rpm
    Size : 2921616 License: GPL
    Packager : Linux-Mandrake Team <bugs@linux-mandrake.com>
    Summary : The RPM package management system
    Description :
    Le gestionnaire de paquetages Red Hat nommé RPM (Red Hat Package
    Manager) est un puissant utilitaire en ligne de commande capable
    d'installer, de désinstaller, de vérifier, d'interroger, et de mettre ŕ jour des paquetages. Chaque paquetage est une archive contenant des fichiers, ainsi que des informations additionnelles sur le paquetage telles que son numéro de version, une description de son contenu, etc.

    (Proof this isn't mine - I don't know a word of French )

    Is there more ?

    Yes in rpm documentation and a good old Google search.
    (rpm - Red Hat Package Manager)

    I do not recall where I obtained this so I cannot, unfortunately, acknowledge the author.

    Hope someone here finds the information of benefit.

    PP

  2. #2
    Junior Member
    Join Date
    Oct 2001
    Posts
    8

    Lightbulb A reply for the RPM Commands (suggestion)

    While the information is with out a doubt correct, the approach leaves a bit to be desired. For the sake of clarity, Giving the commands was a great idea. However, There was no need for the verbose pasting of the term output. That might confuse the neqwbie that this was intended for as well as making it an unnecessarly long posting. Suggested that next time to omit the output for hte sake of clarity and brevity. Other wise this is very good info for the newbie and those who whish to brush up.

    While the information is with out a doubt correct, the approach leaves a bit to be desired. For the sake of clarity, giving the commands was a great idea. However, there was no need for the verbose pasting of the terminal output. That might confuse the newbie as well as making it an unnecessarly long posting. Suggested that next time to omit the output for the sake of clarity and brevity. Other wise this is very good info for the newbie and those who wish to brush up.

  3. #3
    Antionline Herpetologist
    Join Date
    Aug 2001
    Posts
    1,165
    It's a nice post actually, and I think more newbies should take an example from this about how to post unoriginal work. Nice job.
    From the onset I wish to point out that this is NOT my work, but something I found in the dark recesses of my hard drive today
    Buy the Snakes of India book, support research and education (sorry the website has been discontinued)
    My blog: http://biology000.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides