How to determine when the last time package index files were updated

Knowledge of how to determine when the last time package index files were updated can be very useful when you least expect it. It is not something used everyday, but can be used to monitor or verify when apt-get update command was executed.

The idea is very simple as it is based on the modification time of the most recently updated package index file located in /var/lib/apt/lists/ directory.

$ TZ="UTC" date -d @$(find /var/lib/apt/lists/ -type f -not -name lock -printf '%T@\n' | sort -n | tail -1 | cut -d. -f1)
Thu Sep 15 12:50:54 UTC 2016

You can modify it to verify whether specified package index files are up to date.

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu