In case you are wondering when a software package was installed on your Linux system, the information is stored by the package manager and can be accessed via the command line. This can come in handy for a number of reasons, such as when troubleshooting issues that started on a certain date, to see if any packages installed at that time could be causing the problem. In this tutorial, you will learn how to show the installation date for a software package on all major Linux distributions.
In this tutorial you will learn:
- How to show installation date for software on Linux
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Software||apt, dnf, pacman|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Show package installation date
Since Linux distributions tend to use different package managers, you will need to use the command below that corresponds to your Linux system. For example, Ubuntu users will need to use the
dpkgcommands, and Fedora users will use the
rpmcommands. For universal package managers like Snap, the command will be the same on all systems.
There are many advanages to using a package manager for installing software. One such advanage is that the installation date is either kept as metadata inside the package manager or in a log file somewhere. If installing software manually, you will have a much harder time determining this kind of information.
- RPM based distributions can run the following command to see installation dates for all installed software:
$ rpm -qa --last
grepcommand to the end of the command and search for the package you want to see the date for:
$ rpm -qa --last | grep vim vim-minimal-9.0.1429-1.fc37.x86_64 Mon 03 Apr 2023 11:33:09 PM EDT vim-data-9.0.1429-1.fc37.noarch Mon 03 Apr 2023 11:31:09 PM EDT
This output shows that vim was installed 03 April 2023.
- On DPKG sysems, The
dpkginstallers do not have a great way of saving the installation date. Rather than archiving this metadata into a retrievable database, which would have been convenient, installation dates are output to a log file. Then, these log files get regularly rotated. It makes sifting through them a real pain, but we have a one liner command to make the job easier:
$ zgrep 'install ' /var/log/dpkg.log* | sort | cut -f1,2,4 -d' '
The previous command will list the installation date for all of your installed software. If you want to search for a specific package, such as
vim, just append the relevant
grepcommand to the end.
$ zgrep 'install ' /var/log/dpkg.log* | sort | cut -f1,2,4 -d' ' | grep vim /var/log/dpkg.log.12.gz:2022-04-19 10:02:52 vim-common:all /var/log/dpkg.log.12.gz:2022-04-19 10:02:52 vim-tiny:amd64 /var/log/dpkg.log.12.gz:2022-05-12 20:44:53 vim-runtime:all /var/log/dpkg.log.12.gz:2022-05-12 20:44:54 vim:amd64
The output shows that vim was installed 12 May 2022.
- On Arch Linux and derivative distributions, installing the
pacutilspackage allows us to parse the
/var/loc/pacman.loglog file with ease to find installation dates of packages. The command syntax is:
$ paclog --package=[package name]
Let’s try an example where we search for the installation date of nano.
$ paclog --package=nano [2023-01-21T23:37:52-0500] [ALPM] upgraded nano (7.0-1 -> 7.1-1) [2023-02-08T21:07:00-0500] [ALPM] upgraded nano (7.1-1 -> 7.2-1)
From the output, we can see that nano was upgraded twice, with the most recent version being installed on 08 February 2023.
- To see the installation date of a Snap package, use the following command syntax. In this example, we are showing the installation date for the Firefox snap:
$ snap info firefox ... installed: 113.0.2-1 2023-05-09 (2710) 254MB
In this tutorial, we saw how to show the software package installation on a Linux system. RPM systems make this the easiest, by keeping metadata for the installed packages and making the installation date easily retrievable. On the other hand, DPKG systems keep this information in a rotated log file, but luckily Linux gives us the tools to access it easily. Lastly, Arch Linux has an installable tool that can parse relevant files and give us all the information we need for installation dates.