Apt Manually Installed List

There are many ways to show packages installed manually using apt, such as: apt-mark showmanual But sometimes that output is too much. For example if the user. Aptitude List Manually Installed Packages Aptitude is an Ncurses based FrontEnd to Apt, the debian package manager. Mark packages as 'automatically installed'. Aptitude List Manually Installed Packages Aptitude is an Ncurses based FrontEnd to Apt, the debian package manager. Mark packages as 'automatically installed'. Pc Game Raptor there.
This could be done using the Python apt API. The packages you see in apt-mark showmanual are exactly the ones in apt.cache.Cache() for which is_installed is true and is false. But, it's easier to process the dependencies: #!
/usr/bin/env python3 from apt import cache manual = set(pkg for pkg in cache.Cache() if pkg.is_installed and not pkg.is_auto_installed) depends = set(dep_pkg.name for pkg in manual for dep in pkg.installed.get_dependencies('PreDepends', 'Depends', 'Recommends') for dep_pkg in dep) print(' n'.join(pkg.name for pkg in manual if pkg.name not in depends)) Even this lists some packages which I would not expect to see there ( init, grep?!).