Skip to content

Instantly share code, notes, and snippets.

@mitchejj
Created November 26, 2012 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchejj/4146675 to your computer and use it in GitHub Desktop.
Save mitchejj/4146675 to your computer and use it in GitHub Desktop.
Show recently installed packages
#!/bin/bash
# Show recently installed packages
# http://crunchbang.org/forums/viewtopic.php?id=23273
DATE="$1"
DIR=/tmp/$USER-${0##*/}
if [ ! -d $DIR ]; then
mkdir $DIR
fi
cat /var/log/dpkg.log* | grep $DATE | grep "\ install\ " | awk ' { print $4" "substr($0,length($0)-8) }' | egrep -o '^[^:]+' | sort > $DIR/installed
cat /var/log/dpkg.log* | grep $DATE | grep "\ remove\ " | awk ' { print $4" "substr($0,length($0)-8) }' | egrep -o '^[^:]+' | sort > $DIR/removed
KEPT=`comm -23 $DIR/installed $DIR/removed`
printf "INSTALLED PACKAGES:\n`cat $DIR/installed`\n"
printf "REMOVED PACKAGES:\n`cat $DIR/removed`\n"
printf "PACKAGES INSTALLED BUT NOT REMOVED:\n$KEPT\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment