Thread: Howto: Create a list of all "installed" packages by date
################
nb: part grep " \ install\ ", seems not working on 12.04 install. can replace grep -w install while investigate.
################
i've seen request several times on forum , never seen concrete answer: how list packages have been installed since os installed, date. yes, can list using "dpkg -l", doesn't give whole story.
answer comes dpkg.log files in /var/log. there current log (dpkg.log), previous log (dpkg.log.1) , archived logs (dpkg.log.2.gz -> ).
simple command grab current log is:
the previous log:code:cat /var/log/dpkg.log | grep " \ install\ "
and archived logs:code:cat /var/log/dpkg.log.1 | grep " \ install\ "
to full list of packages installed wrote simple bash script. script called pkginstalls.sh, put in home directory , ensured executable:code:zcat /var/log/dpkg.log.2.gz | grep " \ install\ "
here script:code:chmod a+x $home/pkginstalls.sh
running it:code:#!/bin/bash #pkginstalls.sh #creates text file list of packages installed date #first append info archived logs i=2 mycount=$(ls -l /var/log/dpkg.log.*.gz | wc -l) nlogs=$(( $mycount + 1 )) while [ $i -le $nlogs ] if [ -e /var/log/dpkg.log.$i.gz ]; zcat /var/log/dpkg.log.$i.gz | grep "\ install\ " >> $home/pkgtmp.txt fi i=$(( $i+1 )) done #next append info unarchived logs i=1 nulogs=$(ls -l /var/log/dpkg.log.* | wc -l) nulogs=$(( $nulogs - $nlogs + 1 )) while [ $i -le $nulogs ] if [ -e /var/log/dpkg.log.$i ]; cat /var/log/dpkg.log.$i | grep "\ install\ " >> $home/pkgtmp.txt fi i=$(( $i+1 )) done #next append current log cat /var/log/dpkg.log | grep "\ install\ " >> $home/pkgtmp.txt #sort text file date sort -n $home/pkgtmp.txt > $home/pkginstalls.txt rm $home/pkgtmp.txt exit 0
creates file in home directory called pkginstalls.txt can use examine installed , when. unfortunately doesn't show meta-packages such "xubuntu-restricted-extras" if aware of of contents of meta-packages should able track down happened.code:./pkginstalls.sh
delete or rename pkginstalls.txt file before run script again.
if have been religiously installing via command line, , have enabled long enough history file, can similar information (no date, , excluding initial installation) typing:
this script benign , doesn't affect part of system. remove delete script.code:history | grep "apt-get install"
[edit]
there more detailed installation information in /var/log/apt/ in history.log , history.log.x.gz files , term.log , term.log.x.gz files
can tell how restrict command list changes given day, today or last 2 or 3 days? or alternatively can tell me how scroll , down list? when executed these commands list long of couldn't see. helpful when user has crash , wants revert changes might have caused crash.
looking commands used in synaptic or muon repair broken packages.
Forum The Ubuntu Forum Community Other Discussion and Support Tutorials Howto: Create a list of all "installed" packages by date
Ubuntu
Comments
Post a Comment