Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124

Reinstalling Ubuntu or migrating to a new system often means reinstalling dozens, sometimes hundreds of applications. Doing this manually can be time-consuming and error-prone. Fortunately, Ubuntu provides built-in tools that make it easy to preserve your software environment.
In this guide, you’ll learn how to back up & restore installed packages on Ubuntu using native package management tools like dpkg and apt. This approach is reliable, lightweight, and doesn’t require third-party software.
Whether you’re preparing for a clean OS reinstall, setting up a new machine, or maintaining multiple Ubuntu systems, this method ensures you can quickly restore your applications with minimal effort.
Backing up installed packages is not the same as backing up personal files. Instead, it creates a snapshot of:
.deb packageshis does not include software installed via Snap or Flatpak; those require separate backup steps.
This is especially useful if you:
Understanding how to back up & restore installed packages on Ubuntu saves time and prevents forgotten dependencies.
Ubuntu uses the Debian package management system. Two tools are central to this process:
Together, these tools allow you to export a list of installed packages and later reinstall them automatically.
Open the terminal and run:
dpkg --get-selections > installed-packages.list
sudo apt-mark showmanual > manual-packages.list
This command generates a plain text file containing all installed packages and their states. The file can be stored anywhere, but it’s best to keep it in a safe external location such as:
To verify the file:
cat installed-packages.list
cat manual-packages.list
This file is the foundation of restoring your system later.
Knowing how to back up & restore installed packages on Ubuntu isn’t complete without backing up software sources.
Many users install software from:
Without these sources, Ubuntu won’t be able to locate some packages during restoration. Run the following commands:
mkdir ~/repo-backup
sudo cp -r /etc/apt/sources.list* ~/repo-backup/
sudo cp -r /etc/apt/trusted.gpg* ~/repo-backup/
sudo cp -r /etc/apt/keyrings ~/repo-backup/
This backs up:
First we need to copy the backed up installed-packages.list and manual-packages.list files from old system to new system.
scp /path/to/installed-packages.list /path/to/manual-packages.list username@new_system_ip:/destination/path/
Copy the repo configurations to the new server.
sudo scp ~/repo-backup/* username@new_system_ip:/etc/apt/sources.list.d/
sudo apt update
Restore package selections:
sudo dpkg --set-selections < installed-packages.list
sudo apt-get dselect-upgrade
Restore only manually installed packages (cleaner):
sudo xargs apt install -y < manual-packages.list
If both machines are Ubuntu 24.04 with identical repositories, you’ll get the same package versions.
Learning how to back up & restore installed packages on Ubuntu is a powerful skill that saves time, reduces frustration, and improves system reliability. With just a few terminal commands, you can recreate your entire software environment on any Ubuntu installation.
This approach is:
✔ Built-in
✔ Stable
✔ Distribution-friendly
✔ Google-approved best practice