Is there any command to list "local" packages? like in Synaptic GUI

Find installed packages that does not originate from any source.list or cannot be downloaded.

$ aptitude search \
  '?narrow(?or(!?origin(), ?obsolete), ?installed)'

Or short form:

$ aptitude search '~S (!~O|~o)  ~i'
  • ?narrow(filter, pattern)
    Select packages which matches both filter and pattern.
  • ?or(pattern, pattern)
    Matches any of the patterns or both.
  • ?origin(pattern)
    Select packages with given origin.
  • ?obsolete
    Matches installed packages that cannot be downloaded.
  • ?installed
    Select installed packages.
  • ?not(pattern) or !
    Select any package not matching the pattern.

apt list --installed labels packages as local in a way that seems to agree with your definition (see my answer here). You could filter only packages so labelled with ask, grep, etc.:

apt list --installed | awk -F/ '/local]/{print $1}'

You could also probably make a similar check using the Python APT API.


With apt-show-versions | grep -e 'No available version' -e 'newer than version' you should get the list of packages:

  • without a version in any repo.
  • or have higher version than the one in repo.

Probably you need to install it beforehand with sudo apt install apt-show-versions