본문 바로가기

언어/라즈베리파이

설치된 패키지 확인

출처: itsfoss.com/list-installed-packages-ubuntu/

모든 설치된 패키지 확인: apt list --installed

To list all the installed packages using apt:

apt list –installed

Read the rest of the tutorial to know more about other ways and some more tips to fine tune your search for installed packages.

 

특정패키지 확인(firebird관련패키지확인): apt list --installed | grep firebird*

If you use apt command extensively, you would probably expect a command like apt list installed packages. You are not entirely wrong here.

 

While apt-get command doesn’t have a straightforward option like apt-get list installed packages, apt has a command for this.

apt list --installed

This will list all the packages that have been installed using apt. It will also list the packages that were installed as a dependency. Which means that not only you’ll have the applications you installed, you’ll also have a huge list of libraries and other packages that you didn’t install directly.

Listing installed packages with apt command

Check whether a specific package is installed in Ubuntu

Since the list of installed packages is a huge one, it would be a better idea to use grep and filter the output for a certain package.

apt list --installed | grep program_name

A better way is to use this command:

apt -qq list program_name --installed

Both q options are for quiet mode. And this way, it only looks for programs that are installed.

Note that the above method also lists the applications installed with .deb files. That’s cool, isn’t it?

Other ways to check installed packages in Ubuntu/Debian

If you have read my apt vs apt-get comparison article, you probably already know that both apt and apt-get basically use dpkg. This means you can use dpkg command to list all the installed packages in Debian.

dpkg-query -l

You can filter the output with grep again to search for a specific package.

Listing installed packages with dpkg

So far, you have dealt with applications installed with Debian’s package manager. What about Snap and Flatpak applications? How to list them because they are not accessible with apt and dpkg?

To show all the Snap packages installed on your system, use this command:

snap list

Snap list also indicates which applications are from a verified publisher with a green tick.

Listing installed Snap packages

To list all the Flatpak packages installed on your system, use this:

flatpak list

Let me summarize it for you.

Summary

To list packages using apt command:

apt list –installed

To list packages using dpkg command:

dpkg-query -l

To list Snap packages installed on your system:

snap list

To list Flatpak packages installed on your system:

flatpak list

List the recently installed packages

So far you saw the list of installed packages in alphabetical order. What if you want to see the packages that have been installed recently?

Thankfully, a Linux system keeps a log of everything that happens in your system. You can refer to the logs to see the recently installed packages.

There are a couple of ways to do this. You can either use the dpkg command’s log or the apt command’s log.

You’ll have to use grep command to filter the result to list the installed packages only.

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

This will list all the packages including the dependencies that were installed recently on your system along with the time of installation.

2019-02-12 12:41:42 install ubuntu-make:all 16.11.1ubuntu1
2019-02-13 21:03:02 install xdg-desktop-portal:amd64 0.11-1
2019-02-13 21:03:02 install libostree-1-1:amd64 2018.8-0ubuntu0.1
2019-02-13 21:03:02 install flatpak:amd64 1.0.6-0ubuntu0.1
2019-02-13 21:03:02 install xdg-desktop-portal-gtk:amd64 0.11-1
2019-02-14 11:49:10 install qml-module-qtquick-window2:amd64 5.9.5-0ubuntu1.1
2019-02-14 11:49:10 install qml-module-qtquick2:amd64 5.9.5-0ubuntu1.1
2019-02-14 11:49:10 install qml-module-qtgraphicaleffects:amd64 5.9.5-0ubuntu1

You can also use the history of apt command. This will show only the programs that you installed using apt command. It won’t show the dependencies installed with it, though the details are present in the logs. Sometimes, you just want to see that, right?

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

The output should be something like this:

Commandline: apt install pinta
Commandline: apt install pinta
Commandline: apt install tmux
Commandline: apt install terminator
Commandline: apt install moreutils
Commandline: apt install ubuntu-make
Commandline: apt install flatpak
Commandline: apt install cool-retro-term
Commandline: apt install ubuntu-software

Listing recently installed packages

The history log of apt is quite useful because it shows the time when the apt command was run, the user who ran the command and the packages that were installed by a command.