Not sure this is exactly what you are after but I have a cron job that runs:
dpkg --get-selections | grep -v "deinstall$" | grep -v "hold$" | grep
"install" | awk '{print $1;}'
and put the output in a file that I backup or grab, i.e.
~/selections-$(hostname).txt.
The file is usually just a reference but it could be fed to apt after a
minimal install to produce a new similar system.
//PG
On 2020-12-31 11:50, Antony Stone wrote:
> Hi.
>
> I know I can get a list of the packages installed on a currently-running
> system using commands such as:
>
> dpkg-query -l
> apt list --installed
> aptitude search ~i
>
> However, if there any way I can do the same thing, but when I simply have a
> copy (backup) of the machine, and it's not currently running? The backup is
> on another Debian / Devuan system (which may or may not be the same release
> version).
>
> I have _all_ files from the machine I want to investigate, and I'm hoping that
> there's something in /var/cache/apt or /var/lib/dpkg which would allow me to
> get the same sort of list as the above commands produce.
>
> Does anyone have any ideas?
>
>
> Antony.
>