[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: history of system



michael wrote:
I would have thought this was a FAQ but I cannot find the solution, so
all pointers welcome!

Q: how do I see the 'history' of my system, such as what was installed
by apt-get and when

Thanks,
About 3 years ago the same question was posed on this list. This script was posted. I've been using it ever since.

#!/bin/sh

# Here is a simple shell script I run after each apt or dselect run that
# may be helpful.  It basically keeps a text file of what package's are
# currently installed (dpkg -L), which I find faster to grep through when
# I'm looking for something anyway (than using dpkg -S).
#
# The next time the script is run, it uses diff to find the differences
# between the current and last runs, and appends it to a 'history' file.
# So for each date/time apt is run, you can see what packages were added,
# removed or upgraded (along with their versions/descriptions).

# Written by Larry Holish, ljholish@speakeasy.net


# Script that writes current list of packages installed
# from /var/lib/dpkg/available to pkgs_debian.current.
# Keeps a history of changes between package versions
# in debian_history.txt.

LISTDIR=/home/gt/debian
cd $LISTDIR

if [ -f 'debian_history.txt.gz' ]; then
	gunzip debian_history.txt.gz
fi

if [ -f 'pkgs_debian.current' ]; then
	mv pkgs_debian.current pkgs_debian.last
fi

COLUMNS=120 dpkg -l | grep "^i" | cut -b 5- > pkgs_debian.current

diff -C 0 pkgs_debian.last pkgs_debian.current >> debian_history.txt

gzip debian_history.txt
rm -f pkgs_debian.last

# EOF
########
Modify paths and filenames to suit your own sensibilities, of course.

My viewer script is simple;

#!/bin/sh

# This script simply does a zless on the
# /home/gt/debian/debian_history.txt.gz file

cd /home/gt/debian
zless debian_history.txt.gz

# That's all folks.
########
Any parsing beyond the MarkI, mod0 eyeball is written on an ad hoc basis.

cheers, and hth,

gary
--
Anyone can build a usable web site.  It takes a graphics designer to
make it slow, confusing, and painful to use.



Reply to: