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

Re: how to tell what packages are unused on a debian server?



Robert P. J. Day <rpjday@crashcourse.ca> wrote:
>  for instance, if a given shared library hasn't been linked in weeks
> or months, that's something to look at.  if none of the binary
> executables in a package have been executed in that long, another
> package to examine, that sort of thing.

You could possibly do something with this, which checks each installed
package for files that have been accessed in the last six months. Please
note, however, that it cannot work if you mount your relevant filesystems
with noatime!

    for P in $(dpkg -l '*' | awk '/^i/{print $2}')
    do
        echo -n "Checking $P: " >&2
        U=$(
            for F in $(dpkg -L "$P")
            do
                test -f "$F" && find "$F" -atime +180
            done 2>/dev/null
        )
        test -n "$U" && echo "in use" >&2 || echo "MAYBE NOT USED RECENTLY" >&2
    done

Chris


Reply to: