This question already has an answer here:


This is somehow simple; I am migrating to an other computer.
I am going to take the opportunity to switch to the new 18.04 LTS from the 16.04 (on the old computer).

On the 16.04 I installed so many (!) libraries and packages manually using apt-get.


Is there a way to fetch these packages, in a text file for example, that I can copy and paste on the 18.04 to feed an apt-get command to install them back?

marked as duplicate by karel, Zanna, Fabby, Eric Carvalho, muru Dec 7 '18 at 5:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You seem to be looking for the apt-mark command.

apt-mark showmanual will return a list of all packages marked manual.

There are two sets of manual packages, and they are all mixed together:

  1. Packages you specified to apt (sudo apt install foo or sudo apt-mark manual foo) These are the top-level packages in your system. Everything else is a dependency. Usually your desktop metapackage is among these.

  2. Packages installed by the Desktop installer during the initial installation of Ubuntu. This is a safety measure to prevent users from erroneously removing large slabs of their system when they remove their desktop metapackage.

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