Ubuntu 26.04: Undo an APT Install with "apt history-undo"

Updated

Learn how to easily undo a package installation using "apt history-undo"

Ubuntu 26.04: Undo an APT Install with "apt history-undo"

All you need to follow along is terminal access on your Ubuntu system with administrative privileges.

  1. First, we need to find the transaction ID of the installation we want to reverse. Open your terminal and view your recent package management activity by running apt history-list.
  2. Look through the list to find the transaction number corresponding to your recent install. If you want to double-check the exact details of what was installed during that step, you can verify it by typing apt history-info 18.
  3. Once you have confirmed the transaction ID, we can roll back the changes. Type sudo apt history-undo 18 and press enter. Since this command requires administrator permissions, you will need to type your password. Keep in mind that no letters or characters will appear on the screen while you type it.

APT will now process the request and uninstall the packages. Give it a few moments to finish reverting the changes.

To quickly check that everything was undone successfully, run apt history-info 18 again to inspect the current state of that transaction.

Using apt history-undo is much cleaner than manually removing software because it targets and removes the exact dependencies installed during that specific session.