To see a list of all rpm packages by install time. Open a terminal and type:
rpm -q --all --last > ~/tmp.txt
kwrite ~/tmp.txt
Saves output to a file ("> filename") because the dump can be quite large.
Some of the listings will appear to have been installed before you got your distro. That’s apparently due to installing from images, which may be possible to disable if you reset the option to ‘enable installation from images’ in the installation DVD, in case that’s important to anyone.
For a cleaner output from kwrite redirect the stderr output to the null device like so:
kwrite ~/tmp.txt 2>/dev/null
If you don’t mind a little C programming you can easily reverse the order of the printout like this.
// rpm-list lists files by install time, first to last
// compile: gcc rpm-list.c -o rpm-list
// or even smaller: gcc -s rpm-list.c -o rpm-list
#include <stdio.h>
#include <string.h>
#include <malloc.h>
char* lines[16000]; // 16 thousand lines should be enough?
int main(int argc, char** argv)
{
char tmp[256]; // buffer for lines read in.
int counter = 0;
// create a read-only pipe to capture the output from rpm
FILE* fp = popen("rpm -q --all --last", "r");
if(!fp)
return 1; // quit now if there's been an error
while(!feof(fp)) // stop if end of file
{
tmp[0] = 0; // null string byte
fgets(tmp, 256, fp);
if(tmp[0] == 0) break; // stop if nothing read in
// otherwise copy the string to the lines array and bump the counter
lines[counter++] = strdup(tmp);
}
// close the pipe and print out the lines in the reverse order
fclose(fp);
int i; // declare a loop variable, so compile line is simpler (no -std=c99)
// counting down from counter-1 to 0 (inclusive) print out each line.
// and free it as we go... we won't be needing it again.
for(i = counter -1; i >= 0; i--)
{
printf("%s", lines*);
free(lines*);
}
return 0; // no error code
}
[See the “compile:” comment in the source code.]
If this ever crashes, you might want to increase the size of the ‘lines’ array. Or if you know how, you can make a dynamically allocated array and resize it as needed but the openSUSE 11.4 DVD comes with about 4000 packages total, so 16000 lines may well be plenty for even serious software collectors.
Very interesting information rainbowsally. If you don’t want to create a temporary text file or compile any C code, then consider using these following terminal commands:
rpm -q --all --last | less
Or, if you would prefer to see an alpha listing try this:
rpm -q --all | sort | less
Thanks for taking the time to share this with the openSUSE forums.
It seems like the linux-ish way to deal with reversing the line numbers would be to create a utility to do that.
But maybe it’s already been done?
Sure enough. ‘tac’ does it.
rpm -q --all --last | tac
Then this too could be piped through ‘less’ as you did or sent to a kde or gnome editor for viewing and/or editing.
Interestingly, it seems that gnome apps make less noise on the commandline than kde apps, even when running kde apps. Some of those errors and warnings are false, though, I’m pretty sure. The one about popup menus is in a routine that is (at the time) removing and deleting the widgets – in the RIGHT order.
Dev guys: see file
kdeui/xmlgui/kxmlguiclient.cpp
around line 100 or so and find the “popups” warning in the destructor.
What’s “this” if not the accused culprit. And LO! It is being ‘forgotten’
and 2) subsequently deleted, or do I misread that code.
Nice command and placing less at the end prevents the loss of info unless your terminal session has a really large buffer or cache set.
rpm -q --all --last | tac | less
I am told the developers don’t grace our halls here and so if you have a KDE bug to report, you need to use bugzilla: https://bugzilla.novell.com/index.cgi, that is what I do.
On 2011-11-28 11:56, rainbowsally wrote:
>
> hendersj;2410833 Wrote:
>> On Sun, 27 Nov 2011 00:06:02 +0000, rainbowsally wrote:
>>
>>> It seems like the linux-ish way to deal with reversing the line
>> numbers would be to create a utility to do that.
>>
>> sort -r
> Not the same as tac, because sort -r does sort. The listing is by
> dates and they aren’t alpha-numerically sortable.
Not the same, but you just make rpm print lines starting with the date
field, and then you sort.
I just checked out the bash stuff and it has a problem in that it mixes days around.
The purpose (if any) for such a utility would be to see what you installed at a certain time, presumably for a specific job, so that you could uninstall everything you installed at that time, and though the juxtapositioning of fields is pretty nifty, it kind of hashes the data.
The winner is still ‘tac’, in my opinion.
Thanks for the contribution and examples though. I’ve yet to really grasp what tee does. I’d hoped it would let me copy to file as well as display on the terminal but I can’t do that with ‘tee’ apparently??? I’ll study your code some more and see if I can understand what it does and doesn’t do.
On 2011-12-02 11:16, rainbowsally wrote:
>
> Hi again Carlos.
>
> I just checked out the bash stuff and it has a problem in that it mixes
> days around.
No, it doesn’t. It just prints two different dates: the install date and
the build date.
> The purpose (if any) for such a utility would be to see what you
> installed at a certain time, presumably for a specific job, so that you
> could uninstall everything you installed at that time, and though the
> juxtapositioning of fields is pretty nifty, it kind of hashes the data.
>
One of the versions is a csv file which you can import into any spreadsheet
and analyze there. The other is ordered in columns with spaces. Depends on
your preferences.
> The winner is still ‘tac’, in my opinion.
If you are happy with that brief information, yes. If you need to solve
problems, no.
> I’ve yet to really
> grasp what tee does. I’d hoped it would let me copy to file as well as
> display on the terminal but I can’t do that with ‘tee’ apparently???
Think of “pipes” or “tubes”, and you do with a “tee” on pipes. Yes, a copy
of the flow is sent to a file, and another copy continues through the pipe
down.
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)