From the course: Linux: Package Management for CentOS
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
RPM query formatting - Linux Tutorial
From the course: Linux: Package Management for CentOS
RPM query formatting
- [Instructor] Querying the rpm database can be very powerful. If, however, we want to present the information in a certain format, we might want to change the fields that are returned. All packages have tags that we can show or hide. To get a list of all tags in the terminal type in rpm --querytags and hit enter. My CentOS installation lists nearly 190 different tags. You get to decide what you want printed on the screen just by choosing the tags. Type in clear to clear your screen. If I wanted to show the package name and version, but nothing else I could do: rpm -qa --queryformat "%{NAME} %{VERSION}\n". To use the tags, we need to surround them with a percent symbol and curly brackets. For this example, I'm querying all files in the database with the -qa option then I'm specifying a query format of name and version. Notice at the end of the line I have to include \n to insert a new line. If I don't, it will all end up on one line and be hard to read. Now hit enter. If you wanted to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
RPM overview1m 3s
-
Query installed packages with RPM7m 14s
-
(Locked)
RPM query formatting6m 5s
-
(Locked)
Install/remove packages3m 21s
-
(Locked)
Upgrade packages6m 29s
-
(Locked)
Reinstall packages2m 17s
-
(Locked)
Verify package attributes2m 54s
-
(Locked)
Validate package integrity4m 55s
-
(Locked)
Troubleshoot RPM3m 20s
-
(Locked)
-
-
-