Tech Tips

by Staff
Formatting Information about RPMs

RPM packages contain a number of potentially useful information fields, and you can see many of them by using the -q and -i options with a package name:

$ rpm -q -i kernel-desktop
Name        : kernel-desktop         Relocations: (not relocatable)
Version     :              Vendor: openSUSE
Release     : 0.1.1                  Build Date: Thu 28 Jan 2010 ...
Install Date: Sat 20 Feb 2010 ...    Build Host: build35
Group       : System/Kernel          Source RPM: kernel-desktop-...
Size        : 122840714              License: GPLv2
Signature   : RSA/8, Thu 28 Jan 2010 09:16:41 AM MST, ...
Packager    :
URL         :
Summary     : Kernel optimized for the desktop
Description :
This kernel is optimized for the desktop. ...

Source Timestamp: 2010-01-27 08:20:11 +0100
GIT Revision: bb438b6d99aaffb7aade40764bab1810cc21b01b
GIT Branch: openSUSE-11.2
Distribution: openSUSE 11.2

These fields and others can be output individually by using the --qf or --queryformat options for rpm. Not everything above is directly an option, but many are, such as NAME and VERSION, so that you can do something like:

$ rpm -q --qf "Installed kernel is v%{VERSION}\n" kernel-desktop
Installed kernel is v2.6.31.12

The format string is similar to a printf format string, except the type specifier is replaced by the tag to output inside braces. To see a table of all installed packages and their versions, you could do this:

$ rpm -q -a --qf '%-30{NAME}  Version %{VERSION}\n'|head
gpg-pubkey                      Version a1912208
yast2-trans-stats               Version 2.15.0
yast2-country-data              Version 2.18.20
libpciaccess0                   Version 7.4
libpth20                        Version 2.0.7
libpcre0                        Version 7.9.0
netcat                          Version 1.10
libusb-1_0-0                    Version 1.0.2
libbz2-1                        Version 1.0.5
libgmp3                         Version 4.3.1

You also can change the formatting for an item by appending a qualifier. For example, in the info listing above, there's a field called Install Date. The actual rpm tag is INSTALLTIME, and if you use that directly you get a less-than-useful value:

$ rpm -q --qf "Kernel installed %{INSTALLTIME}\n" kernel-desktop
Kernel installed 1266703208

For something more useful, append :date to the tag:

$ rpm -q --qf "Kernel installed %{INSTALLTIME:date}\n" kernel-desktop
Kernel installed Sat 20 Feb 2010 03:00:08 PM MST

—mantra UNIX

Connect to Your Google Calendar from the Command Line with gcalcli

gcalcli is an easy-to-use command-line tool to interact with your Google Calendar. gcalcli probably is not installed by default on your system, but it may be available via your package manager. If it's not available, get the source at

Once installed, you can view your current calendar week by typing:

$ gcalcli --user USERNAME --pw PASSWORD calw

To view the current month of calendar, the command is very similar:

$ gcalcli --user USERNAME --pw PASSWORD calm

Adding an item to your calendar is easy as well with the quick option:

$ gcalcli --user USERNAME --pw PASSWORD quick \
             'Write another Tech Tip for LJ tomorrow 5pm'

gcalcli has many other options, such as choosing your own color scheme and agenda view. See the man page for more options.

—Kristofer Occhipinti (aka Metalx1000)

Get Rid of the Annoying “x is an executable text file” Message Box

When using GNOME, if you open a text file that has the execute bit set, you get an annoying message box each time saying “Do you want to run x.txt or display its content? x.txt is an executable text file.”

To get rid of this annoying message box, in Nautilus, go to Edit→Preferences→Behaviour, and check the radio button next to view executable text files when they are opened. The next time, the file will open directly, and no such message box will irk you.

—Manoj Gumber

Send a tech tip to, and if we publish it in the magazine, we'll send you a free T-shirt.

Load Disqus comments