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 Answers 3


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.

  • Why apt list/aptitude search '?essential'/~E include apt but dpkg-query alternative doesn't? Isn't dpkg-query the correct output?
    – Pablo A
    Commented May 11, 2022 at 5:50
aptitude search ~E

for other search patterns you can look in aptitude doc.

  • 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .