1

I am completely reinstalling kubuntu to my machine since gnome crashed occasionally for its long standing bugs.

How could retrieve a list of all the packages I have ever apt installed and install them to a fresh kubuntu system with one command line?

Wizard
  • 2,951

1 Answers1

2

There are several ways to list installed packages

dpkg -l
# or
dpkg-query -f '${binary:Package}\n' -W
# or
dpkg --get-selections | grep -v deinstall
# or
apt list --installed

Now, you want to save the list of installed packages and use the list with a fresh install.
- Save the installed packages list to a file
- Launch an apt install command feeded with the file

# SourcePC : Save a list of installed packages
dpkg-query -f '${binary:Package}\n' -W > /path/to/installList.txt

# TargetPC : Prepare, Install, Clean
# -- Prepare
sudo apt update 
sudo apt-get dist-upgrade
# -- Install packages list from file
sudo apt install $(< /path/to/installList.txt)
# -- Clean: Fix eventually broken dependencies and remove unnecessary
sudo apt -f install
sudo apt autoremove
cmak.fr
  • 8,976