10

When I run synaptic, there are certain packages which synaptic treats as "essential". For example, if I select bash for removal, I will be warned that bash is an "essential package". If I then press the apply button I get a list of packages that are going to be acted on. One of those lists is the list of essential packages that I am about to remove.

Using the apt toolset, how can I vgenerate a list of all the packages that synaptic considers essential?

3 Answers3

14

You can list all essential packages using aptitude search '?essential' or dpkg-query -Wf '${Package;-40}${Essential}\n' | grep yes.

Additionally there are also several packages with priority required that you shouldn't remove, too: dpkg-query -Wf '${Package;-40}${Priority}\n' | grep -E "required"

For your information, Essential and Priority are fields in the control file of a package.

Lesmana
  • 27,439
scai
  • 10,793
6
aptitude search ~E

for other search patterns you can look in aptitude doc.

rush
  • 27,403
2
  • for daily use: apt list ?essential or apt list ~E
  • for script: apt-cache show ~E | grep -Po '(?<=^Package: ).*'

?essential and ~E are documented in apt-patterns(7), available on Ubuntu 20.04 LTS and Debian 11.

youfu
  • 261