Results 1 to 4 of 4

Thread: Terminal command to list "Installed (local or obsolete)" packages?

  1. #1
    Join Date
    Jun 2016
    Beans
    2,831
    Distro
    Xubuntu

    Terminal command to list "Installed (local or obsolete)" packages?

    In Synaptic Package Manager, there is an option to list the packages that are "Installed (local or obsolete)". What is the terminal command to get this same list?

    (I tried aptitude search '(?obsolete)' but it doesn't list the locally-installed packages for which an older version is available in the standard repositories.)
    Xubuntu 22.04, ArchLinux ♦ System76 hardware, virt-manager/KVM, VirtualBox
    When your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Terminal command to list "Installed (local or obsolete)" packages?

    $ sudo ubuntu-support-status ... something something something.

  3. #3
    Join Date
    Jun 2016
    Beans
    2,831
    Distro
    Xubuntu

    Re: Terminal command to list "Installed (local or obsolete)" packages?

    Thanks TheFu!

    This command comes close -
    Code:
    ubuntu-support-status --show-unsupported
    It gives exactly the list of packages I want, but surrounded by a bunch of other info that I don't want. Looking at the ubuntu-support-status script shows how to write my own Python 3 script to print only the desired info, so I'll do that for now.

    (And just to add, because Internet searching didn't find any documentation of the apt Python 3 module: said documentation can be installed by running sudo apt-get install python-apt-doc )
    Xubuntu 22.04, ArchLinux ♦ System76 hardware, virt-manager/KVM, VirtualBox
    When your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  4. #4
    Join Date
    Jun 2016
    Beans
    2,831
    Distro
    Xubuntu

    Re: Terminal command to list "Installed (local or obsolete)" packages?

    Here's the Python 3 script I ended up with. I named it apt-locally-installed
    Code:
    #!/usr/bin/env python3
    
    import apt
    
    with apt.Cache() as cache:
      for pkg in cache:
        if pkg.is_installed and not(pkg.candidate and pkg.candidate.downloadable):
          print(pkg.name, pkg.installed.version, sep='\t')
    Xubuntu 22.04, ArchLinux ♦ System76 hardware, virt-manager/KVM, VirtualBox
    When your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •