In his answer, goldilocks wrote “‘non-essential’ is hugely
subjective”, and this is essentially correct. However, the package
maintainers have their own idea of how important a package is, and this
information is available in the package’s metadata as the priority
field. The defined priorities are:
- required: Packages which are necessary for the proper functioning
of the system [...]
- important: Important programs, including those which one would
expect to find on any Unix-like system. [...]
- standard: These packages provide a reasonably small but not too
limited character-mode system. [...]
- optional: This is all the software that you might reasonably want
to install if you didn't know what it was and don't have specialized
requirements. [...]
- extra: This contains all packages that conflict with others with
required, important, standard or optional priorities, or are only
likely to be useful if you already know what they are or have
specialized requirements [...]
For the full description of the priority levels (this is only an
excerpt), see the Debian Policy
Manual.
If you want to rely on this assessment of importance, you could use for
example the following command to list the size and name of every
optional and extra package on your system, sorted by size:
dpkg-query -Wf '${Installed-Size}\t${Package}\t${Priority}\n' | \
egrep '\s(optional|extra)' | cut -f 1,2 | sort -nr | less
This command comes from the comment thread in “How To Free Up Some Space
On Your Raspbian SD Card? Remove Wolfram &
LibreOffice”.
It can provide a list of candidates for removal. You can then inspect
each package in the list (apt-cache show <package-name>
) and decide
whether you want to remove it or not.
The command above could be easily modified for automatically purging all
the packages from the list, but I don't think it would be wise to do so.
Edit: To illustrate why it is unwise to automatically remove all
packages listed as low priority, I just noticed this one in the latest
Jessie Lite:
Package: raspberrypi-kernel
Provides: linux-image
Priority: extra
Description: Raspberry Pi bootloader
This package contains the Raspberry Pi Linux kernel.
...
I cannot understand why it is listed as Priority: extra
. I certainly
would not want to remove it.