I am about do move a server from one Ubuntu box to another. I'm not cloning the old box to the new; I'm creating a new system and will move data as needed. I want to install all the software that I have on the old box on the new one.
Is there a simple way to find the history of all the "sudo apt-get install" commands I have given over time? That is, dpkg -l shows me all the packages that have been installed, but not which top-level package installed them. If there is a way for dpkg to give me the installing package, I can find the unique ones there; otherwise, I want something else to say "you installed these 24 packages".
The
apt
history is in/var/log/apt/history.log
as said in a comment above. That said, this will not list packages that were installed manually, usingdpkg
or GUIs such asgdebi
. To see all the packages that went throughdpkg
, you can look at/var/log/dpkg.log
.You can list packages whose installation has been explicitly requested with
apt-mark
.In case you're running an ancient release of Debian, here's a manual way.
The following command gives the list of packages whose installation was requested, whether manually or automatically. Unless you're in the middle of (de)installing packages, this is the list of installed packages.
The following command gives a superset of automatically installed packages:
Putting it all together, the following command lists manually installed packages:
http://www.debianadmin.com/clone-your-ubuntu-installation.html
and /var/adm/apt/history.log
I'm also "greping" tar.gz-ed history files this way:
If you need timestamp too, just add an extra parameter
-B1
.Instead of tac / head combination, it is better to use tail (for last 25 lines):
Shows all the packages you've installed using:
sudo apt-get install xxxxx
The other answers helped but gave me too much output. To cut down on the output, I started with
apt-mark showmanual
as in this answer, and then filtered out packages originally installed (see this answer for how to get a list of packages originally installed; I'm using ubuntu 18.04.2 hence the link below).The script filters out packages that were in the original manifest by doing a version-independent comparison, so that upgraded packages don't appear in the list. I ended up with a list of about 60 packages.
The other way I like is this answer that searches all the apt logs.
Getting an uncluttered list turned out to be a fair bit more complicated than I imagined. In the end, I have wrapped it up in a bash script (
export-custom-packages
). Have a look and use it if you wish. It"Setup":
Usage: See
export-custom-packages --help
.The annotated code is on Github.
To get the list of most recent installed packages in descending order, I like using (e.g. 25 lines):