How to determine when package index was updated

Determine when package index was updated.

Ubuntu is using a timestamp file to mark an successfull package index update.

$ cat /etc/apt/apt.conf.d/15update-stamp 
APT::Update::Post-Invoke-Success {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};

Inspect current timestamp.

$ stat --format "%y" /var/lib/apt/periodic/update-success-stamp
2022-07-02 17:24:42.233369776 +0000

Update package index.

$ sudo apt update
Hit:1 jammy InRelease
Hit:2 jammy-updates InRelease
Hit:3 jammy-backports InRelease
Hit:4 jammy-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

Inspect updated timestamp file.

$ stat --format "%y" /var/lib/apt/periodic/update-success-stamp
2022-07-02 17:30:13.855014199 +0000