#!/bin/sh # print unused packages that may be deleted # It only check if last access time of binaries is older than a month by default. # It doesn't check for libs, only bins DAYS=30 # Number of days since last access LAST=$(($(date +%s) - ($DAYS * 24 * 3600))) echo "Those packages haven't been used in the last $DAYS days : " for P in $(pkg_info | cut -d' ' -f1); do BINS=$(pkg_info -L $P |grep '/usr/local/bin') for B in $BINS; do # check if $B is a link B=$(readlink -f $B) if [ $(stat -f %a $B) -lt $LAST ]; then echo "$P | $B" fi done done