This answer applies to Linux Mint 18.2 and onwards, although I've tested it only for 18.3.
A command line tool called
mintupdate-tool is now included with the distribution. It's advertised in the 18.2 release notes as "This tool supports all the features available in the UI, including level selection, security updates, kernel updates and blacklisting". That "UI" refers to the Update Manager and that claim is a long way from being true, but it is a big step forward.
man page for this tool, so:
$ mintupdate-tool --help
usage: mintupdate-tool [-h] [-k | -nk] [-s] [-r] [-d] [-y]
[--install-recommends] [-l LEVELS]
command command to run (possible commands are: list, upgrade)
-h, --help show this help message and exit
-k, --kernel ignore settings and include all kernel updates
-nk, --no-kernel ignore settings and exclude all kernel updates
-s, --security ignore settings and include all security updates
-r, --refresh-cache refresh the APT cache
-d, --dry-run simulation mode, don't upgrade anything
-y, --yes automatically answer yes to all questions
--install-recommends install recommended packages (use with caution)
-l LEVELS, --levels LEVELS
ignore settings and restrict to this list of levels
The preferences from Update Manager determine the default behaviour. Those preferences are in the active user's
dconf data store (schema com.linuxmint.updates), so prefacing the command with plain
sudo does not change this. That is important because updates are not possible without root privileges.
Warning: There is no way to exclude security updates if including them is enabled in Update Manager preferences.
Option parsing for “--levels” is a bit sloppy and non-obvious. LEVELS is a string which is searched for the appearance of the digits 1 through 5. It is not a threshold or range. It also doesn't check for invalid characters, so "14", "1-4", "1,4", "4..1", and "two4u14me" all just mean levels 1 and 4 only.
To simply list the available updates that would be installed by default according to the user's Update Manager preferences, you probably want this:
$ mintupdate-tool -r list
You probably don't want the "-r" option in the following commands in order to avoid surprises.
To perform a dry run of what an actual update with this tool would do:
$ mintupdate-tool --dry-run upgrade
To actually do the same update we'd get if we used the Update Manager without modifying the displayed selections:
$ sudo mintupdate-tool upgrade
In my opinion, it is a significant oversight to not include an update type column for the "list" command as it appears in Update Manager and to provide no means to query an update's description or change log. My current example:
$ sudo mintupdate-tool -l 12345 list
4 package mesa 17.2.4-0ubuntu1~16.04.4
That's a level 4 update called "mesa", which is not a package name so I cannot query it with any other command line tools that I know of. I know from Update Manager that this particular update actually includes 9 different packages, but that's cheating.
The source code.