Stop A Package From Upgrading

Its nice to keep an older version of a software package for various reasons. In Debian based distributions such as ubuntu, linux mint, or debian itself this is simple as long as you know the package name. For this example I will be holding back gedit.

To hold the package, stopping it from upgrading: echo "gedit hold" | dpkg --set-selections

To stop the hold on the package, allowing it to upgrade: echo "gedit install" | dpkg --set-selections

In case you would like to know if a package is on hold or not: dpkg --get-selections gedit