Software & AppsOperating SystemLinux

How To Get a List of Recently Installed Packages with Apt-Get

Ubuntu 2

In this article, we will explore various ways to get a list of recently installed packages on a Linux system using the apt-get command and other related tools. This can be particularly useful when troubleshooting, auditing, or simply keeping track of changes on your system.

Quick Answer

To get a list of recently installed packages with apt-get, you can use the dpkg.log file or the apt-get history log. Alternatively, you can use the Ubuntu Software Center’s history feature or the wajig command-line tool. Another method is to list all dpkg installed packages.

Understanding Apt-Get

Apt-get is a powerful command-line tool used in Debian-based systems like Ubuntu for handling packages. It allows administrators to install, update, upgrade, and remove software packages.

Using the dpkg.log File

One of the simplest ways to get a list of recently installed packages is to use the dpkg.log file. This file logs all dpkg activities, including installations.

grep " install " /var/log/dpkg.log

The grep command is used to search the dpkg.log file for lines containing the word “install”. This will display a list of installed packages along with the date and time of installation.

Using the Apt-Get History Log

Apt-get maintains a history log that records all apt-get commands that have been run. This includes the packages that have been installed.

grep " install " /var/log/apt/history.log

This command works similarly to the previous one, but it searches the apt-get history log instead of the dpkg.log file.

Using Ubuntu Software Center

If you prefer a graphical interface, the Ubuntu Software Center provides a history feature. It shows the whole history of installed, upgraded, and removed packages.

To access this feature, simply open the Ubuntu Software Center and click on the “History” button at the bottom of the left-hand list.

Using the Wajig Command-Line Tool

Wajig is a command dispatcher that provides various commands for package management. It can be used to list packages that have become available since the last update.

wajig new

The new command lists new packages that have been made available since the last update.

Listing Dpkg Installed Files

Another method is to list all dpkg installed packages, which includes packages installed through apt-get.

grep -A 1 "Package: " /var/lib/dpkg/status | grep -B 1 -Ee "ok installed|half-installed|unpacked|half-configured|config-files" -Ee "^Essential:yes" | grep "Package:" | cut -d\ -f2

This command is a bit more complex. The grep command is used to search the dpkg status file for lines containing the word “Package:”. The -A 1 and -B 1 options tell grep to also print the line before (-B) and the line after (-A) the matching line. The cut command is then used to extract the package names.

Conclusion

In this article, we’ve explored several methods to get a list of recently installed packages on Ubuntu. Whether you prefer working with the command line or a graphical interface, there’s a method that will suit your needs. Remember, keeping track of installed packages is an important part of system administration and can help you troubleshoot problems or audit system changes.

How can I view the list of recently installed packages using `apt-get`?

To view the list of recently installed packages using apt-get, you can use the grep command to search the dpkg.log file. The command is grep " install " /var/log/dpkg.log. This will display a list of installed packages along with the date and time of installation.

Can I use the Ubuntu Software Center to see the history of installed packages?

Yes, you can use the Ubuntu Software Center to see the history of installed packages. Simply open the Ubuntu Software Center and click on the "History" button at the bottom of the left-hand list. This will show you the whole history of installed, upgraded, and removed packages.

What is the `wajig` command-line tool and how can it help in listing recently installed packages?

Wajig is a command dispatcher that provides various commands for package management. It can be used to list packages that have become available since the last update. To list new packages, you can use the command wajig new. This will display a list of new packages that have been made available since the last update.

How can I list all the `dpkg` installed packages, including those installed through `apt-get`?

To list all the dpkg installed packages, including those installed through apt-get, you can use the following command: grep -A 1 "Package: " /var/lib/dpkg/status | grep -B 1 -Ee "ok installed|half-installed|unpacked|half-configured|config-files" -Ee "^Essential:yes" | grep "Package:" | cut -d\ -f2. This command will extract the package names from the dpkg status file.

Leave a Comment

Your email address will not be published. Required fields are marked *