apt full-upgrade versus apt-get dist-upgrade
In accordance with man pages:
-
apt
has parameterfull-upgrade
-
apt-get
has parameterdist-upgrade
.
Are both the same command?
btw: which is officially the recommended command in Ubuntu 16.04? apt
or apt-get
?
Solution 1:
apt full-upgrade
performs the same function as apt-get dist-upgrade
.
man apt
full-upgrade (apt-get(8)) performs the function of upgrade but will remove currently installed packages if this is needed to upgrade the system as a whole.
man apt-get
dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The dist-upgrade command may therefore remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also apt_preferences(5) for a mechanism for overriding the general settings for individual packages.
Solution 2:
Yes they are the same command. This part of apt's cmdline/apt.cc
source file proves it:
static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
{
return {
// [snip]
// system wide stuff
{"update", &DoUpdate, _("update list of available packages")},
{"upgrade", &DoUpgrade, _("upgrade the system by installing/upgrading packages")},
{"full-upgrade", &DoDistUpgrade, _("upgrade the system by removing/installing/upgrading packages")},
// misc
{"edit-sources", &EditSources, _("edit the source information file")},
{"moo", &DoMoo, nullptr},
// for compat with muscle memory
{"dist-upgrade", &DoDistUpgrade, nullptr},
// [snip]
};
}
And for completeness, cmdline/apt-get.cc:
static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
{
return {
// [snip]
{"dist-upgrade", &DoDistUpgrade, _("Distribution upgrade, see apt-get(8)")},
{"full-upgrade", &DoDistUpgrade, nullptr},
// [snip]
};
}
For both apt
and apt-get
, full-upgrade
and dist-upgrade
both refer to the same DoDistUpgrade
function and therefore do the exact same thing.
I first posted this info to complement schod's answer in an edit, but it was rejected so I'm answering myself instead...
Solution 3:
Use apt as a first choice, but if you're scripting use apt-get. Apt-get has more stable output (meaning that the output format is left alone as much as possible so as not to break scripts which parse that output automatically). Apt-get also has some low-level commands not available in apt.
The manual pages for apt and apt-get describe full-upgrade and dist-upgrade a little differently, but they are probably the same command (apt accepts dist-upgrade as an alias of full-upgrade). This serves as a good example of apt-gets stability. In apt, the name was changed to be more user friendly, while in apt-get the name remains unchanged so as not to break compatibility with old scripts.
Solution 4:
apt and apt-get are two different commands. apt
is the newer command and should be used as default. You should change to using apt over apt-get as apt is better.