Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

The apt command has the nice behavior to log all what you request it to do in /var/log/apt/history* file. This is quite handy, because in case of reinstall you can see which packages you have installed/removed/etc in the old system with the command:

zcat history.log.{6,5,4,3,2,1}.gz | cat - history.log|  grep "Commandline" | egrep "install|remove "

Which will output things like (excerpt):

Commandline: apt-get --auto-remove install xpra
Commandline: apt-get --auto-remove install python-opengl
Commandline: apt-get --auto-remove remove xpra
Commandline: apt-get --auto-remove install winswitch
Commandline: apt-get --auto-remove purge fonts-khmeros-core
Commandline: apt-get --auto-remove install terminator gnuplot-doc gnuplot

which, with a bit of programming (eliminating pairs of install/remove), could be reduced to a series of packages to install to have a handy list to reinstall your preferred software after afresh installation. If you look at the history* filea, all these actions are timestamped too, which can be quite handy.

The only really missing thing is that the log is missing changes to the repositories, especially the add-apt-repository used to add the PPAs.

Is there any place where the commands that add/remove PPAs or repositories log their actions?

PD: I know how to list all active PPAs in my system --- and I can add all the PPAs first, and then replay the installs --- no problem. But I would like to have the addition of the PPAs in the above list, in the correct sequence.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.