I have Ubuntu WSL installed on two different Windows 10 accounts. I want to have the same packages installed in Acct-2 as I have in Acct-1. Is there an easy way? I have a complex way.

  • This seems like, basically, a duplicate of this. I'd expect the same method to work. – mkasberg Nov 9 '18 at 16:08
  • Why bother? One of the original reasons, many years ago, for the development of Apt was easy, on-demand installs. When you need a new application (like LibreOffice), simply tell Apt to install it (sudo apt install libreoffice), and let Apt handle all the details. – user535733 Nov 9 '18 at 16:27
  • @user535733, It's hard to remember the various packages you've installed over the years, and it's inconvenient to have to install them on the fly. – Wes Nov 9 '18 at 17:58
  • In that case, use @mkasberg's link – user535733 Nov 9 '18 at 18:37

Here is my complex answer. Make sure that Acct-2 uses the same repositories as Acct-1. Create a list of packages from Acct-1 in a directory accessible to both Accounts, e.g. /mnt/c/WorkTemp and then remove the packages already installed in Acct-1. Install the remaining packages in Acct-2

Specifically, on Acct-1:

sudo apt-get update
sudo apt-get upgrade
aptitude search '~i!~M' | sort | >/mnt/c/WorkTemp/aptitudelist-1

Do the same on Acct-2 piping into /mnt/c/WorkTemp/aptitudelist-2

comm -23 /mnt/c/WorkTemp/aptitudelist-{1,2} >/mnt/c/WorkTemp/pkglist

Review /mnt/c/WorkTemp/pkglist deleting the lines containing packages you don't want in Acct-2. Then in Acct-2:

sudo apt-get install $(tr -s ' ' </mnt/c/WorkTemp/pkglist |cut -d ' ' -f2)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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