Say I want to install all the ubuntu-wallpapers
packages, so I would enter the following at the terminal:
sudo apt install ubuntu-wallpapers*
I am trying to get the same effect using
dpkg --set-selections < ./pkgs.txt
The problem is, this method does not support the *
wildcard in the pkgs.txt
file.
i was able to get the exact list of packages using
apt-cache search ^ubuntu-wallpapers
but I get the descriptions too. Is there a way to get only the package names so I can redirect the output to the pkgs.txt
file?
You can use
apt-cache pkgnames
to list only the names of all packages starting with a specific prefix:See
man apt-cache
for more info.Alternatively, you could process the output of
apt-cache search
and display only the first column by piping it e.g. through one of these commands below or anything similar:Alternative using
apt list
andegrep
:Search for a group of packages
Search for a group of packages starting with
The command in the middle is to get just the package name. Also works with
cut -f1 -d"/"
.If given a list of packages you want to know which ones you don't have already installed:
For the first parameter, you can replace with
apt-mark showmanual
to compare to the manually installed packages.Beware: