I have file called packages.list which has the name of the packages like:

a11y-profile-manager        install
a11y-profile-manager-indicator  install
account-plugin-facebook     install
account-plugin-flickr       install
account-plugin-google       install
accountsservice             install
acl                         install
acpi-support                install
acpid                       install
activity-log-manager        install
adduser                     install
adium-theme-ubuntu          install
adwaita-icon-theme          install
adwaita-icon-theme-full     install
aisleriot                   install
alsa-base                   install
alsa-utils                  install
anacron                     install
apg                         install

I want to know is there any way to install the packages listed in the file using apt and also I want to ignore any packages that are already installed.

  • 1
    That looks like it is in the format provided by the dpkg --get-selections command - and so should be readable by dpkg --set-selections. However there are some caveats about package availability - see the dpkg manual page – steeldriver Apr 14 '18 at 13:22
  • 1
    Thanks! That seems to work. I will add this as an answer. – pro neon Apr 14 '18 at 13:33

I think this command is useful for your requirement.

dpkg --get-selections | grep -v deinstall

As directed by @steeldriver the packages.list file is provided by the dpkg --get-selections and hence they are readable by dpkg --set-selections . So the solution:

sudo dpkg --set-selections < ~/Packages.list

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.