- How do I see what packages are installed on Ubuntu Linux?
- How do I see what packages are installed on Ubuntu Linux?
- apt list installed packages
- List all installed packages only
- How to list or find out if a specific package installed or not
- Ubuntu list installed packages
- Listing installed packages sorted by installation date and time
- Conclusion
- How to List Installed Packages on Ubuntu and Debian-based Linux Distributions
- List installed packages in Ubuntu and Debian
- Check whether a specific package is installed in Ubuntu
- Other ways to check installed packages in Ubuntu/Debian
- List the recently installed packages
- Bonus Tip: Show installed applications in Software Center
- Как пользоваться apt
- Синтаксис и опции apt
- Как пользоваться apt
- 1. Обновление пакетов
- 2. Установка пакетов
- 3. Удаление пакетов
- Выводы
How do I see what packages are installed on Ubuntu Linux?
I am a new Ubuntu Linux server user. My server hosted at Google cloud VM. How do I see what packages are installed on Ubuntu Linux?
Introduction: Ubuntu Linux is an open source operating system based upon the Linux kernel and GNU command line utilities. Ubuntu Linux is extremely popular among new Linux users as well as developers all around the globe. This page shows how to list all installed packages with apt command or apt-get command on Ubuntu Linux.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Debian or Ubuntu Linux |
Est. reading time | 5 minutes |
You need to use the apt or apt-get or dpkg command to list all installed packages on an Ubuntu Linux server from the bash shell prompt.
How do I see what packages are installed on Ubuntu Linux?
The procedure to list what packages are installed on Ubuntu:
- Open the terminal application or log in to the remote server using ssh (e.g. ssh user @ sever-name )
- Run command apt list —installed to list all installed packages on Ubuntu
- To display a list of packages satisfying certain criteria such as show matching apache2 packages, run apt list apache
Let us see some examples about how to list installed packages on Ubuntu and Debian Linux operating systems.
apt list installed packages
Let us list all software packages on Ubuntu Linux available for us:
$ apt list
You might want to use the grep command/egrep command to filter out:
$ apt list | grep nginx
OR
$ apt list | more
However, you may see message on screen that read as follows:
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
To avoid this message use the dpkg command as follows:
$ dpkg —list | grep nginx
$ dpkg —list | more
List all installed packages only
The apt command displays both installed and packages available to install. What if you want to list currently installed software only? Fear not, pass the option to the apt command:
$ apt list —installed
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
How to list or find out if a specific package installed or not
Run package policy as follows:
$ apt list -a pkgNameHere
Is sudo package installed?
$ apt list -a sudo
Is sudo package mariadb-server?
$ apt list -a mariadb-server
Ubuntu list installed packages
It is also possible to list installed packages matching given pattern. The syntax is:
dpkg -l pattern
dpkg —list pattern
apt list pattern
apt list —installed pattern
For example:
dpkg —list ‘x*’
Sample outputs:
- ii – Indicates that package named xauth installed.
- un – Indicates that package not installed or in Unknown status.
Listing installed packages sorted by installation date and time
There is no simple command, but we can use the combination of zgrep and other commands as follows. Let us count it:
Total installed packages on nixcraft-wks01 : 6433
List them:
zgrep » installed » /var/log/dpkg.log*
Please note that zgrep will search possibly compressed files for a regular expression as those log files are compressed by system. Hence, we need to use various z commands on Linux. See “How to find out when Debian or Ubuntu package installed or updated” for more info.
Conclusion
You learned how to list both installed and uninstalled packages on an Ubuntu Linux server or desktop using the CLI method. See the following man pages using the man command:
man apt
man apt-get
man dpkg
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
How to List Installed Packages on Ubuntu and Debian-based Linux Distributions
Last updated August 23, 2021 By Abhishek Prakash 20 Comments
So you installed Ubuntu and started using it extensively. Somewhere down the line, you are bound to lose the track of the software that you had installed over the time .
That’s perfectly normal. No one expects you to remember all the packages installed on your system. But the question arises, how to know what packages have been installed? How to see the installed packages?
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.
List installed packages in Ubuntu and Debian
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.
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.
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.
A better way is to use this command:
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.
You can filter the output with grep again to search for a specific package.
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 also indicates which applications are from a verified publisher with a green tick.
To list all the Flatpak packages installed on your system, use this:
Let me summarize it for you.
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.
This will list all the packages including the dependencies that were installed recently on your system along with the time of installation.
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?
The output should be something like this:
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.
Bonus Tip: Show installed applications in Software Center
If you are not comfortable with the terminal and the commands, you still has a way to see the applications installed on your system.
You can open the Software Center and click on the Installed tab. You’ll see the list of applications that have been installed on your system.
It won’t show the libraries and other command line stuff though but perhaps you don’t want to see that as you are more GUI centric. Otherwise, you can always use the Synaptic Package Manager.
That’s it
I hope this quick little tutorial helped you to see the list of installed packages on Ubuntu and Debian based distributions.
If you have questions or suggestions to improve this article, please leave a comment below.
Like what you read? Please share it with others.
Источник
Как пользоваться apt
Пакетный менеджер Apt или Advanced Package Tool используется во множестве дистрибутивов, основанных на Debian или Ubuntu, а таких дистрибутивов сейчас очень много. Этот пакетный менеджер поддерживает все необходимые функции, вы можете устанавливать и удалять пакеты, обновлять то, что было уже установлено, искать пакеты, устанавливать их из файла или загружать без установки. При этом все зависимости будут разрешаться автоматически.
Утилита apt ничем не уступает пакетному менеджеру yum, используемому в RPM дистрибутивах, да, здесь все ещё не поддерживается частичное обновление пакетов, как в Zypper, но в целом всё выглядит очень неплохо. В этой статье мы подробно рассмотрим как пользоваться apt в Linux для решения задач работы с программами.
Синтаксис и опции apt
Синтаксис команды apt очень простой и похож на другие команды Linux:
$ apt опции команда параметры_команды
Опции указывают общее поведение утилиты, команда — действие, которое надо выполнить, а в параметрах команды обычно передается имя пакета, с которым следует работать, например, установить или удалить. Вот основные опции утилиты:
- -v, —version — выводит версию утилиты;
- -h, —help — выводит справку по использованию утилиты;
- -y, —yes — автоматически отвечать «да» на все возникающие вопросы;
- —assume-no — автоматически отвечать «нет» на все возникающие вопросы;
- -d, —download-only — только скачать пакеты и больше ничего не делать;
- -f, —fix-broken — исправить недостающие зависимости;
- —no-download — ничего не загружать, использовать только пакеты из кэша;
- -s, —simulate — режим симуляции, никакие операции не выполняются, только выводится информация на экран;
- —allow-unauthenticated — позволяет установить пакеты, из репозиториев, для которых нет GPG подписи;
- —no-install-recommends — не устанавливать рекомендованные пакеты, по умолчанию будут установлены;
- -m, —ignore-missing — игнорировать пакеты, которые существует;
- -q, —quiet — выводить минимум информации, не показывать прогресс бар;
- -V, —verbose-versions — показывать полные версии обновленных пакетов;
- —only-upgrade — не устанавливать новые пакеты, только обновлять;
- —allow-downgrades — разрешить откатывать версию пакетов;
- —reinstall — переустановить пакет если он уже установлен;
А теперь давайте пройдёмся по командам apt, которые вы можете использовать:
- install — установить пакет;
- remove — удалить пакет, конфигурационные файлы, которые были изменены в вашей системе удалены не будут;
- purge — полностью удалить пакет, вместе со всеми его конфигурационными файлами;
- autoremove — очистить ненужные пакеты;
- autoclean — очистить кэш пакетов;
- update — обновить списки пакетов из репозиториев;
- upgrade — обновить версию пакета до последней, если пакет не указан будут обновлены все пакеты;
- full-upgrade — полное обновление системы, включая удаление несовместимых или больше ненужных пакетов;
- list — список установленных пакетов;
- search — поиск пакетов;
- show — посмотреть информацию о пакете;
- download — скачать пакет в текущую папку;
- edit-sources — открыть с настройками репозиториев в текстовом редакторе.
- source — скачать исходный код пакета в текущую папку;
- build-dep — установить зависимости необходимые для сборки выбранного пакета;
Дальше рассмотрим несколько примеров работы с apt, которые пригодятся как начинающим, так и более опытным пользователям.
Как пользоваться apt
1. Обновление пакетов
Сначала давайте обновим список пакетов apt из репозиториев. Репозитории находятся на удалённых серверах и когда утилита apt ищет пакет для установки, естественно, что она не обращается ко всем репозиториям подряд чтобы узнать где он находится. В системе уже есть сохранённых кэш информации о том, какие пакеты вообще есть и где их можно скачать. Для обновления этого кэша используйте команду update:
sudo apt update
Во время загрузки URL репозиториев обозначаются специальными префиксами, вот что они означают:
- Hit (Сущ) — список не изменился с момента предыдущей загрузки;
- Ign (Игн) — репозиторий игнорируется, либо он слишком новый, либо произошла незначительная ошибка во время загрузки;
- Get(Пол) — доступна новая версия и она будет загружена.
Когда кэш обновлен вы можете посмотреть для каких пакетов доступны обновления:
sudo apt list —upgradable
Аналогично можно посмотреть установленные пакеты apt:
sudo apt list —installed
Или всех доступных:
sudo apt list —all-versions
Затем можно обновить все пакеты в системе:
sudo apt full-upgrade
2. Установка пакетов
Чтобы установить пакет apt используйте команду install, например, для установки программы Gimp используйте команду install:
sudo apt install gimp
Если пакет установился неверно и вы хотите его переустановить, можно использовать опцию —reinstall:
sudo apt install gimp —reinstall
Как видите, опции можно указывать не только перед командой, но и после неё, аналогично можно установить несколько пакетов сразу, например:
sudo apt install gimp inkskape -y
Чтобы не подтверждать установку вручную используем опцию -y. Допустим вы установили пакет с помощью dpkg и теперь хотите установить для него зависимости, запустите команду install без параметров с опцией -f или —fix-broken:
sudo apt install —fix-broken
Можно скачать deb пакет в текущую папку без установки:
apt download gimp
Скачивать пакеты надо от имени обычного пользователя, иначе тогда они не будут доступны для работы с ними. Если вам нужно установить пакет из файла, просто передайте путь к файлу команде install:
sudo apt install gimp_2.8.22-1_amd64.deb
Чтобы установить определенную версию пакета просто укажите нужную версию после имени пакета через знак =, например:
sudo apt install linux-headers-generic=4.15.0.20.23
Чтобы найти доступные версии можно использовать команду policy. Она отображает информацию о том какая версия установлена, а также какие версии доступны:
sudo apt policy linux-headers-generic
Если вы не знаете как точно называется пакет, можно выполнить поиск пакетов apt с помощью команды search:
sudo apt search gimp
3. Удаление пакетов
Чтобы удалить ненужный пакет используйте команду remove:
sudo apt remove gimp
Однако если вы изменяли какие-либо конфигурационные файлы из состава пакета, то при таком способе удаления они останутся в системе, чтобы удалить всё полностью используйте команду purge:
sudo apt purge gimp
Чтобы удалить лишние пакеты, которые в системе больше не нужны выполните команду autoremove:
sudo apt autoremove
А для очистки кэша пакетов — autoclean:
sudo apt autoclean
Выводы
В этой статье мы рассмотрели примеры использования и основные команды apt Ubuntu, как видите, команд у этой утилиты хватает на все случаи жизни. Но, как видите, всё очень просто если разобраться. Я не рассказал только об одной команде, попробуйте ввести в терминале apt moo, увидите что будет. Это небольшая пасхалка от разработчиков.
Источник