Wednesday, September 12, 2018

How To View A Particular Package Installed/Updated/Upgraded/Removed/Erased Date On Linux

https://www.2daygeek.com/how-to-view-a-particular-package-installed-updated-upgraded-removed-erased-date-on-linux

I can damn sure installing, updating and removing packages in Linux system is one of the routine activity for Linux administrator, also they need to push a security updates to Linux system when it requires.
For this whole activity, package manager is playing the major role and we can’t perform all these action without a package manager.
If you would like to know when the package has installed or updated or erased then you are in the right page to get the information.
In this tutorial you will be learning about the package activity such as installed date, package updated date, package erased date, package removed date, and who had performed that action.
All the package managers are doing the same work but their functionality is different compared with others. We had already written all of these in the past. If you would like to check these then go to the corresponding URL which is listed below.
All the package managers are allowing us to install a new package, update a existing packages, remove un-wanted packages, erase obsolete packages, etc.,
Below are the famous package managers for Linux.

How To View Package Installed/Updated/Erased Date In CentOS/RHEL Systems

RHEL and CentOS systems are using YUM package manager hence we can use the yum.log file and yum history command to get this information.
YUM stands for Yellowdog Updater, Modified is an open-source command-line front-end package-management utility for RPM based systems such as Red Hat Enterprise Linux (RHEL) and CentOS.
Yum is the primary tool for getting, installing, deleting, querying, and managing RPM packages from distribution repositories, as well as other third-party repositories.
If you would like to check the package installed date, just run the following command format and change the package that you want to check. Here we are going to check the htop package installed date.
# grep -i installed /var/log/yum.log | grep htop
May 03 08:40:22 Installed: htop-1.0.3-1.el6.x86_64
To view package updated date, just run the following command format.
# grep -i updated /var/log/yum.log | grep java
May 08 08:13:15 Updated: 1:java-1.8.0-openjdk-headless-1.8.0.171-3.b10.el6_9.x86_64
May 08 08:13:15 Updated: 1:java-1.8.0-openjdk-1.8.0.171-3.b10.el6_9.x86_64
To view package removed/erased date, just run the following command format.
# grep -i erased: /var/log/yum.log | grep epel-release
May 17 17:38:41 Erased: epel-release
If you would like to see all together in the single output, just run the following command format.
# grep "java" /var/log/yum.log
Apr 19 03:47:53 Installed: tzdata-java-2018d-1.el6.noarch
Apr 19 03:48:00 Installed: 1:java-1.8.0-openjdk-headless-1.8.0.161-3.b14.el6_9.x86_64
Apr 19 03:48:00 Installed: 1:java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64
May 08 08:13:15 Updated: 1:java-1.8.0-openjdk-headless-1.8.0.171-3.b10.el6_9.x86_64
May 08 08:13:15 Updated: 1:java-1.8.0-openjdk-1.8.0.171-3.b10.el6_9.x86_64

How To View Package Installed Date In CentOS/RHEL Systems

Alternatively we can check the package latest installed date using rpm command.
RPM stands for RPM Package Manager formerly known as Red Hat Package Manager is a powerful package management system for Red Hat Enterprise Linux (RHEL) as well as other Linux distribution such as Fedora, CentOS, and openSUSE. RPM maintains a database of installed packages and their files, so you can invoke powerful queries and verification’s on your system.
To view the latest installed date of package, just run the following rpm command format.
# rpm -qi nano | grep "Install Date"
Install Date: Fri 03 Mar 2017 08:57:47 AM EST      Build Host: c5b2.bsys.dev.centos.org
Alternatively use rpm with qi option to view the latest installed date of package.
# rpm -qa --last | grep htop
htop-1.0.3-1.el6.x86_64                       Thu 03 May 2018 08:40:22 AM EDT
Alternatively use rpm with q option alone to view the latest installed date of package.
# rpm -q epel-release --last
epel-release-6-8.noarch                       Fri 18 May 2018 10:33:06 AM EDT

How To View Package Installed/Updated/Erased Date In CentOS/RHEL Systems

Also we can check the package installed or updated or removed or erased date using
yum history command.
Use yum history command, if you want to list what are the packages that has installed/updated/erased in the particular date.
# yum history
Loaded plugins: fastestmirror, security
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    27 | root               | 2018-07-22 00:19 | Install        |    1
    26 | root               | 2018-07-20 00:24 | Install        |    1
    25 | root               | 2018-05-18 10:35 | Install        |    1
    24 | root               | 2018-05-18 10:33 | Install        |    1
    23 | root               | 2018-05-17 17:38 | Erase          |    3
    22 | root               | 2018-05-10 04:12 | Install        |    1
    21 | root               | 2018-05-09 05:25 | Erase          |    2
    20 | root               | 2018-05-09 05:24 | Install        |    2
    19 | root               | 2018-05-09 05:19 | Install        |    1
    18 | root               | 2018-05-09 05:08 | Install        |    2
    17 | root               | 2018-05-09 05:05 | Erase          |    1
    16 | root               | 2018-05-08 08:18 | Install        |    3
    15 | root               | 2018-05-08 08:17 | Install        |    8
    14 | root               | 2018-05-08 08:13 | Update         |    2
    13 | root               | 2018-05-08 08:12 | Install        |    4
    12 | root               | 2018-05-08 08:12 | Install        |    2
    11 | root               | 2018-05-03 08:44 | Install        |    2
    10 | root               | 2018-05-03 08:40 | Install        |    1
     9 | root               | 2018-04-26 12:30 | Install        |   30
     8 | root               | 2018-04-26 08:11 | Install        |   69
To view detailed information, just use the corresponding yum transaction ID.
# yum history info 27
Loaded plugins: fastestmirror, security
Transaction ID : 27
Begin time     : Sun Jul 22 00:19:51 2018
Begin rpmdb    : 574:7545d911e1217a575a723f63b02dd71262f9ccbb
End time       :            00:19:52 2018 (1 seconds)
End rpmdb      : 575:0861abf520414edea27be5a28796827ff65d155a
User           : root 
Return-Code    : Success
Command Line   : localinstall oracleasm-support-2.1.8-1.el6.x86_64.rpm
Transaction performed with:
    Installed     rpm-4.8.0-55.el6.x86_64                       @anaconda-CentOS-201605220104.x86_64/6.8
    Installed     yum-3.2.29-81.el6.centos.noarch               @base
    Installed     yum-metadata-parser-1.1.2-16.el6.x86_64       @anaconda-CentOS-201605220104.x86_64/6.8
    Installed     yum-plugin-fastestmirror-1.1.30-40.el6.noarch @base
Packages Altered:
    Install oracleasm-support-2.1.8-1.el6.x86_64 @/oracleasm-support-2.1.8-1.el6.x86_64
history info

How To View Package Installed/Updated/Upgraded/Erased Date In Ubuntu/Debian/LinuxMint Systems

Debian based systems are using APT and APT-GET package manager hence we can use the history.log and dpkg.log file to get this information.
If you would like to check the package installed date, just run the following command format and change the package that you want to check.
$ grep -A 2 "Install: nano" /var/log/apt/history.log
Install: nano:amd64 (2.8.6-3)
End-Date: 2018-08-09  09:12:05
If you would like to check who has performed the package installation, just run the following command format.
$ grep -A 3 "apt install nano" /var/log/apt/history.log*
/var/log/apt/history.log:Commandline: apt install nano
/var/log/apt/history.log-Requested-By: daygeek (1000)
/var/log/apt/history.log-Install: nano:amd64 (2.8.6-3)
/var/log/apt/history.log-End-Date: 2018-08-09  09:12:05
To view package removed/erased date, just run the following command format.
$ grep -A 2 "Remove: nano" /var/log/apt/history.log
Remove: nano:amd64 (2.8.6-3)
End-Date: 2018-08-09  08:58:34

How To View Package Installed/Updated/Upgraded/Erased Date In Ubuntu/Debian/LinuxMint Systems

Alternatively we can check the package latest installed date using dpkg command.
DPKG stands for Debian Package is a tool to install, build, remove and manage Debian packages, but unlike other package management systems, it cannot automatically download and install packages or their dependencies.
$ grep -i "install\|installed\|half-installed" /var/log/dpkg.log | grep firefox
2018-07-18 10:25:46 status half-installed firefox:amd64 60.0.2+build1-0ubuntu0.17.10.1
2018-07-18 10:25:53 status half-installed firefox:amd64 60.0.2+build1-0ubuntu0.17.10.1
2018-07-18 10:25:53 status half-installed firefox:amd64 60.0.2+build1-0ubuntu0.17.10.1
2018-07-18 10:25:54 status installed firefox:amd64 61.0.1+build1-0ubuntu0.17.10.1
2018-07-18 10:29:25 status half-installed firefox-locale-en:amd64 60.0.2+build1-0ubuntu0.17.10.1
2018-07-18 10:29:25 status half-installed firefox-locale-en:amd64 60.0.2+build1-0ubuntu0.17.10.1
2018-07-18 10:29:25 status installed firefox-locale-en:amd64 61.0.1+build1-0ubuntu0.17.10.1
To view package upgraded/updated date, just run the following command format.
$ zgrep "upgrade" /var/log/dpkg.log* | grep mutter
/var/log/dpkg.log.8.gz:2017-12-05 16:06:42 upgrade gir1.2-mutter-1:amd64 3.26.1-2ubuntu1 3.26.2-0ubuntu0.1
/var/log/dpkg.log.8.gz:2017-12-05 16:06:43 upgrade mutter-common:all 3.26.1-2ubuntu1 3.26.2-0ubuntu0.1
/var/log/dpkg.log.8.gz:2017-12-05 16:06:44 upgrade libmutter-1-0:amd64 3.26.1-2ubuntu1 3.26.2-0ubuntu0.1
/var/log/dpkg.log.8.gz:2017-12-05 16:06:44 upgrade mutter:amd64 3.26.1-2ubuntu1 3.26.2-0ubuntu0.1
To view package removed/erased date, just run the following command format.
$ zgrep -i "remove" /var/log/dpkg.log* | grep nano
/var/log/dpkg.log:2018-08-09 08:58:32 remove nano:amd64 2.8.6-3 

How To View Package Installed/Updated/Upgraded/Erased Date In suse/openSUSE Systems

susu and openSUSE systems are using zypper package manager hence we can use the zypper history.log file to get this information.
If you would like to check the package installed date, just run the following command format and change the package that you want to check.
# grep "install" /var/log/zypp/history | grep nano
2018-08-09 10:54:01|command|root@linux-7whv.suse|'zypper' 'install' 'nano'|
2018-08-09 10:54:02|install|nano|2.4.2-5.3|x86_64|root@linux-7whv.suse|download.opensuse.org-oss|d91c91b06b26f689bada77d5a09031f4473912a4|
2018-08-09 10:54:02|install|nano-lang|2.4.2-5.3|noarch||download.opensuse.org-oss|57093a090d6187378592416896532f0e8ebee471|
To view package removed/erased date, just run the following command format.
# grep "remove" /var/log/zypp/history | grep nano
2018-08-09 10:54:37|command|root@linux-7whv.suse|'zypper' 'remove' 'nano'|
2018-08-09 10:54:37|remove |nano-lang|2.4.2-5.3|noarch||
2018-08-09 10:54:38|remove |nano|2.4.2-5.3|x86_64|root@linux-7whv.suse|
You might see the results with multiple output with the same package, in this case you need to note down the latest installed date since it’s keeping all the details
about the package.
To view package upgraded/updated date, just run the following command format.
# grep "install" /var/log/zypp/history | grep java
2017-10-31 14:28:02|install|timezone-java|2017c-0.39.7.2|noarch||download.opensuse.org-oss_1|8cf2af9a90f096ec4e793f273950514b1c0c5bad2ff975eaa7ff10b325365736|
2017-10-31 14:32:03|install|javapackages-tools|2.0.1-12.3.1|x86_64||download.opensuse.org-oss_1|4f703fbf1fe68c86985535f7b0c176f6644eded924da81828fc0d8f0986887a8|
# 2017-10-31 14:33:12 java-1_8_0-openjdk-headless-1.8.0.144-10.15.2.x86_64.rpm installed ok
2017-10-31 14:33:12|install|java-1_8_0-openjdk-headless|1.8.0.144-10.15.2|x86_64||download.opensuse.org-oss_1|21ec7c68894fd53b03158b94570b4529b23f5c6531f88870e60d7aa2881b2d85|
2017-10-31 14:33:35|install|libjavascriptcoregtk-4_0-18|2.12.5-1.6|x86_64||openSUSE-42.2-0|4edefc705bb97a30dd30d79afe3efdd8e0b9d800|
2017-10-31 14:33:36|install|libjavascriptcoregtk-1_0-0|2.4.11-2.10|x86_64||openSUSE-42.2-0|45863597bdef961af2d8403d5952a1a99c3b127d|
# 2017-10-31 14:41:36 java-1_7_0-openjdk-headless-1.7.0.141-42.3.1.x86_64.rpm installed ok
2017-10-31 14:41:36|install|java-1_7_0-openjdk-headless|1.7.0.141-42.3.1|x86_64||download.opensuse.org-oss_1|1f0d97f6a0d2afa62c7145388f6b44f0e9c93c76a1c2e06f1f549b5958ed0a29|
2017-10-31 14:42:28|install|java-1_8_0-openjdk|1.8.0.144-10.15.2|x86_64||download.opensuse.org-oss_1|365471dce54474ce167fc8b236d7f690888734bd44af7ccae32d6e1469e64707|
# 2017-10-31 14:44:26 java-1_8_0-openjdk-plugin-1.6.1-2.35.x86_64.rpm installed ok
2017-10-31 14:44:26|install|java-1_8_0-openjdk-plugin|1.6.1-2.35|x86_64||openSUSE-42.2-0|f6486d25ddd255a518b17f43140fe4992760e6c4|
2017-10-31 14:45:40|install|java-1_7_0-openjdk|1.7.0.141-42.3.1|x86_64||download.opensuse.org-oss_1|f6bbc1ca6245dcee1ae3763bcdc9f2c0d0fc1a0ff6c1d0dfd9f0ee92bb492204|
# 2017-10-31 14:56:44 java-1_7_0-openjdk-plugin-1.6.2-3.3.3.x86_64.rpm installed ok
# update-alternatives: warning: forcing reinstallation of alternative /usr/lib64/java-1_8_0-openjdk-plugin/lib/IcedTeaPlugin.so because link group javaplugin is broken
2017-10-31 14:56:44|install|java-1_7_0-openjdk-plugin|1.6.2-3.3.3|x86_64||download.opensuse.org-oss_1|1689d87b05e7c4d757c1295fbdc1b5644d2071688bcb4540e12fd00f7d758fcf|
2018-08-09 11:03:05|install|java-1_8_0-openjdk-headless|1.8.0.151-10.18.2|x86_64|root@linux-7whv.suse|download.opensuse.org-oss_1|95fe5a29b816db759dec1950cc83b5ecf0c23b6b31ca4a0eabd05cf9cdfb0532|
2018-08-09 11:03:05|install|java-1_8_0-openjdk|1.8.0.151-10.18.2|x86_64||download.opensuse.org-oss_1|8c167c4185275dd7ff48e44db6666f0050c9cacc4fab83be69c75acb3edaffd5|

How To View Package Installed/Updated/Upgraded/Erased Date In Arch Linux Systems

Arch Linux based systems are using pacman package manager hence we can use the pacman history.log file to get this information.
If you would like to check the package installed date, just run the following command format and change the package that you want to check.
$ grep "installed" /var/log/pacman.log | grep firefox
[2017-08-24 06:43] [ALPM] installed firefox (55.0.2-1)
Alternatively, we can use the following command as well to get this details.
$ pacman -Qi firefox | grep "Install Date"
Install Date    : Thu 24 Aug 2017 06:43:43 AM UTC
To view package removed/erased date, just run the following command format.
$ grep "removed" /var/log/pacman.log | grep nano
[2018-08-09 05:59] [ALPM] removed nano (2.8.6-1)
To view package upgraded/updated date, just run the following command format.
$ grep "upgraded" /var/log/pacman.log | grep nano
[2017-08-24 06:02] [ALPM] upgraded nano (2.8.6-1 -> 2.8.7-1)

No comments:

Post a Comment