How to tell apt update all packages except one package

Hi, how do I tell the apt command to update all packages except one package? For example, say I do not wish to update a package named nginx. How can I tell apt to apply updates to all except the nginx package? Is it possible?

  1. Use the apt-mark hold command to hold back package from upgrades:
    sudo apt-mark hold pkg1 pkg2
  2. Then apply updates:
    sudo apt update && sudo apt upgrade
  3. You can remove hold i.e. remove held packages:
    sudo apt unhold pkg1 pkg2
  4. In your case here is how to tell apt to update all packages except nginx package:
    sudo apt-mark hold nginx && sudo apt upgrade
  5. See our tutorial " apt-get hold back packages on Ubuntu / Debian Linux " for more info.
2 Likes