Skip to content

Instantly share code, notes, and snippets.

@tmhedberg
Created July 24, 2011 18:37
Show Gist options
  • Save tmhedberg/1102924 to your computer and use it in GitHub Desktop.
Save tmhedberg/1102924 to your computer and use it in GitHub Desktop.
List Arch Linux packages recently added to the system
#!/bin/bash
# List Arch Linux packages recently added to the system
#
# Usage:
#
# pacweek [<since>]
#
# Default interval is 1 week ago.
#
# Requires GNU date & combine from moreutils.
#
[[ $# -gt 0 ]] &&
interval="$*" ||
interval='1 week ago'
startd=`date -d "$interval" +%s`
parselog () {
awk -v sd=$startd -v pat=$1 '
{
sub(/^\[/, "", $1)
"date -d "$1" +%s" | getline d
}
d >= sd && $3 == pat { print $4 }
' /var/log/pacman.log 2>/dev/null |
sort
}
combine <(parselog installed) not <(parselog removed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment