List only packages specifically installed by the user with apt (or other pkg man). Without dependencies nor default packages. Without using History
Matthew Barrera
So basically only the ones mentioned in commands such as sudo apt install X etc...
I have not seen any post on this. Only about all installed packages on the system regardless of them being dependencies or actually installed by me.
So if I have for instance only ever installed one package :
user@host 31/12/2019 00:33:15 :/sys/class/power_supply $ sai tlp
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed: ethtool tlp-rdwI would like to get only tlp and not ethtool tlp-rdw.
PS : I am looking for a solution that doesn't require the use of bash history. (cause : outside of history limit | multiple sessions overriding each other | old machine | friend computer | etc..)
11 Answer
Run the following command in a bash shell to list all manually installed packages:
comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u) This command is compatible with operating system that use apt package manager. In the first sentence of the question you mentioned sudo apt install. I have assumed that your operating system uses apt, so the above command will run successfully on it.
This command is useful to prepare a list of manually installed packages for installation by apt on a different machine. Before installing the list of manually installed packages on a different machine it is a good idea to review the list and remove packages from the list that were installed but not used much, especially large packages that take a lot of disk space.