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-rdw

I 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..)

  • I'm voting to close this question as off-topic because this question belongs on Ask Ubuntu in the Stack Exchange network. – Cyrus Dec 31 '19 at 17:53

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.