Check the time stamp of /var/lib/apt/periodic/update-success-stamp
.
$ ls -l /var/lib/apt/periodic/update-success-stamp
-rw-r--r-- 1 root root 0 Jan 25 01:41 /var/lib/apt/periodic/update-success-stamp
Here the time is Jan 25 01:41
when apt-get
last executed. To get the time only, use the following command in terminal,
$ ls -l /var/lib/apt/periodic/update-success-stamp | awk '{print $6" "$7" "$8}'
Jan 25 01:41
It is the best place to check the last update time. If you found /var/lib/apt/periodic/
to be empty you can try,
ls -l /var/log/apt/history.log
Update
It is found that due to some reasons above files update-success-stamp
or history.log
remain unavailable in some systems. There is a new proposal from derobert to look into the file /var/cache/apt/pkgcache.bin
.
pkgcache.bin
is Apt's memory mapped package cache location. It get renewed after each update. So it is the perfect candidate to know the last time when apt
was updated.
One can use the following command to know the exact time,
ls -l /var/cache/apt/pkgcache.bin | cut -d' ' -f6,7,8
or
stat /var/cache/apt/pkgcache.bin