Saturday, May 11, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 991  / 1 Year ago, fri, may 26, 2023, 2:47:40

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?


More From » command-line

 Answers
2

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

[#878] Saturday, May 27, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eatack

Total Points: 245
Total Questions: 120
Total Answers: 113

Location: Estonia
Member since Wed, Jun 8, 2022
2 Years ago
eatack questions
Sun, Mar 6, 22, 20:44, 2 Years ago
Tue, Feb 8, 22, 20:50, 2 Years ago
Sat, May 20, 23, 13:30, 1 Year ago
Fri, Apr 28, 23, 06:04, 1 Year ago
;