How do I search for a specific installed app using `apt list --installed`?

apt list --installed

The above command will list all installed apps which is usually more than 100 but I need to see all apps that start with a specific word

Example:
I have installed more than 2 wine versions and I want to uninstall them but when I write apt list --installed, even scrolling to reach the top is time consuming so I want some way to make this list smaller like the command ls win* in directories

Note: I'm using Ubuntu 21


Solution 1:

apt list --installed | grep wine should do what you want.

Solution 2:

Since apt version 1.8, you can use aptitude style patterns to narrow searches involving package names. So for example

apt list '?narrow(?installed,?name(wine))'

or (using the ~i and ~n shorthands for ?installed and ?name)

apt list '?narrow(~i,~nwine)'

See also:

  • aptitude: Search term reference

  • Blog of Julian Andres Klode

and related quetion

  • Problem using wildcard with apt