and need to install all snaps listed by snap list?
So you are using the snap list command to list all the snap packages. When we call snap list it prints many rows and columns (similar to dpkg -l), for example on my machine:
$ snap list
Name Version Rev Tracking Publisher Notes
bare 1.0 5 latest/stable canonical* base
core18 20211215 2284 latest/stable canonical* base
core20 20220114 1328 latest/stable canonical* base
gnome-3-34-1804 0+git.3556cb3 77 latest/stable/… canonical* -
gnome-3-38-2004 0+git.1f9014a 99 latest/stable canonical* -
gtk-common-themes 0.1-59-g7bca6ae 1519 latest/stable/… canonical* -
snap-store 3.38.0-66-gbd5b8f7 558 latest/stable/… canonical* -
snapd 2.54.3 14978 latest/stable canonical* snapd
So, you can't simply run sudo snap install $(cat snap-list.txt).
You need to use the awk utility to print only the names of the packages.
Run snap list > snap-list on the machine you have installed all your snap packages.
Transfer the snap-list file to your new laptop.
Open a terminal and cd into the directory containing the snap-list file.
Run the following command:
awk -F "\t" 'NR>1 {print $1}' snap-list | xargs sudo snap install