I have a file that contains the output of apt list --installed from another machine.
i.e.
accountsservice-ubuntu-schemas/focal,focal,now 0.0.7+17.10.20170922-0ubuntu1 all [installed,automatic]
accountsservice/focal-updates,focal-security,now 0.6.55-0ubuntu12~20.04.5 amd64 [installed,automatic]
acl/focal,now 2.2.53-6 amd64 [installed,automatic]
…and so on.
Is there an easy way to install these packages using the aforementioned file and the command line?
>Solution :
You can extract the part before the first / and use that with xargs to install via apt:
xargs -a <(awk -F/ '{print $1}' some-file) apt install
Or:
awk -F/ '{print $1}' some-file | xargs apt install -y