Find out which RPMs were installed on a particular date. These would (naturally) include update RPMs. This example shows searching for "Thu 05 Mar" (with grep). Alternatively, pipe it to less so you can search inside less (with less's neat text highlighting of the search term): rpm -qa --queryformat '%{installtime} \"%{vendor}\" %{name}-%{version}-%{release} %{installtime:date}\n' | less # (this example) search term: Thu 05 Mar Show Sample Output
Replace 'more' command with any command which is in your PATH. Show Sample Output
This command could seem pretty pointless especially when you can get the same result more easily using the rpm builtin queryformat, like:
rpm -qa --qf "%{NAME} %{VERSION} %{RELEASE}.%{ARCH}\n" | sort | column -t
but nonetheless I've learned that sometimes it can be quite interesting trying to explore alternative ways to accomplish the same task (as Perl folks like to say: There's more than one way to do it!)
Show Sample Output
the newest rpms are at the top; individual packages can also be queried this way: rpm --last -q package
You can use wildcard with rpm search but you have to do 2 things:
1. use "-a" switch (means "all") with query ("-q") switch - argument is a pattern to use while searching for package names of all installed packages
2. protect wildcards, so that shell could not eat them - escape it with backslash ("\") or enclose all pattern between apostrophes ("'"):
rpm -qa 'co*de'
As you can see above it is possible to insert wildcards into middle of the pattern.
If you want, you can add "-i" or another rpm query options, "-i" will print package information for all installed packages matching pattern.
Show Sample Output
Low on disk space? Check the largest installed RPMs for delete canditates. Show Sample Output
Lists all installed RPM packages with name and architecture, which is useful to check for compability packages (+ required i386 packages) on a 64bit system. Show Sample Output
In this case, I'm getting the package version for 'redhat-release', but of course, this can be applied to any package installed on the filesystem. This is very handy in scripts that need to determine just the version of the package, without the package name and all the sed and grep hackery to get to the data you want. To find out all the support format strings that 'rpm --qf' supports:
rpm --querytags
Show Sample Output
It's all said in the title. Show Sample Output
if you want to see all information about a package use: rpm -qi pkgname full list of querytags can be accessed by the command: rpm --querytags you can also customize the query format how ever you like with using more querytags together along with escape sequences in "man printf"! you can also use more than one package name. for example this command shows name and version in to columns: rpm -q --queryformat %-30{NAME}%{VERSION}\\n pkg1 pkg2 Show Sample Output
For Linux distributions using rpm (eg Mandriva), this command will find the rpm package name that provides a file. Show Sample Output
Many times I give the same commands in loop to find informations about a file. I use this as an alias to summarize that informations in a single command. Now with variables! :D Show Sample Output
If somehow if you get more than 1 same name rpm package install, then it cannot be removed by using simple rpm -e as it gives you more than one rpm matches error. The --matches will help to remove all the same name rpm packages.
This command is very helpful when we need to duplicate a test scenario and first we want to find out the installed libraries together with the version and release numbers and architecture. (look example) Command can be tuned by choosing just the names of libraries we are interested in. For example glibc and gcc. Show Sample Output
rpm, sometimes, is not wildcard friendly. To search files installed from package this could be useful. change PACKAGENAME to any package do you want to search Show Sample Output
On Fedora clean the boot directory; erase older kernel
Description is moved to "Sample output" because the html sanitizer for commandlinefu breaks the examples.. Show Sample Output
This should be an option to rpm, but isn't. I wind up using it a lot because I always forget the full name of the packages I want to delete.
\n Separates out the architectures on different lines. Show Sample Output
Interesting to see which packages are larger than the kernel package. Useful to understand which RPMs might be candidates to remove if drive space is restricted. Show Sample Output
I use this as an alias to get all .service files related a single installed file/conf (if it has services, of course). For rpm based systems ;) Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: