pro-tip: "apt" and "apt-get" do the exact same thing

Forum Forums General Software pro-tip: "apt" and "apt-get" do the exact same thing

This topic contains 7 replies, has 5 voices, and was last updated by 736b69646f6f Jul 17-8:54 pm.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #11349
    Member
    Sadshark [p.n.2001]
    Sadshark [p.n.2001]

    This is just a PSA to all my fellow Linux users out there. Any time you are typing out commands by hand, such as upgrade or update commands, just know that apt-get is an obsolete turn of phrase. Here’s the reason why: “sudo apt update” does the exact same thing as “sudo apt-get update” , “sudo apt install x program” does the same as “sudo apt-get install x program.” I figured out about this change around the time Kubuntu 16.04 Xenial Xerus was released, as I think the change was instated at that time. This askubuntu theread here, specifically the first answer explains some minor differences between the two.

    Don’t take my word for it. Try it for yourself!

    Running Antix 17 on my Compaq Mini 110c-1100
    On my desktop running Kubuntu 18.04 LTS
    The antinatalist antifascist childfree vegan mini-manifesto
    Bertolt Brecht's beautiful poem, the Unconquerable Inscription.

    #11350
    Forum Admin
    dolphin_oracle
    dolphin_oracle

    yeah and “apt” has some nice touches like progress bars which is nice. I’ve also been using it to install local debs as well.

    apt install ./name_of_deb which will get your depends pulled in, unlike dpkg and I think nicer than gdebi.

    #11351
    Member
    Sadshark [p.n.2001]
    Sadshark [p.n.2001]

    oh wow @dolphin_oracle I didn’t know you could apt install an actual .deb file. I ought to try that some time. Beats doing dpkg install and then having to install all those libraries by hand.

    Running Antix 17 on my Compaq Mini 110c-1100
    On my desktop running Kubuntu 18.04 LTS
    The antinatalist antifascist childfree vegan mini-manifesto
    Bertolt Brecht's beautiful poem, the Unconquerable Inscription.

    #11389
    Member
    fungalnet
    fungalnet

    apt upgrade and apt-get dist-upgrade are not the same thing.
    apt dist-upgrade does not work.
    Many other options on those two commands are different and will not do the same thing.
    Nor are the differences between the two historically consistent, so you may find remarks in forums and archives that were valid before and are no longer valid. Debian has been going back and forth between which to have as primary use of pkg handling and which to phase out.

    #11436
    Member
    Sadshark [p.n.2001]
    Sadshark [p.n.2001]

    @fungalnet wtf of course sudo apt dist-upgrade works why would I lie for no god damn good reason? I just did it on both of my PCs! You need to just try things before being pointlessly, aimlessly argumentative about them. All the functions that most people would use, like sudo apt update, sudo apt upgrade, sudo apt install, sudo apt -f install, etc all work exactly the same and I’m sure you didn’t even try it to see before arguing.

    Running Antix 17 on my Compaq Mini 110c-1100
    On my desktop running Kubuntu 18.04 LTS
    The antinatalist antifascist childfree vegan mini-manifesto
    Bertolt Brecht's beautiful poem, the Unconquerable Inscription.

    #11440
    Member
    Avatar
    736b69646f6f

    ok let’s find some middle ground.
    thanks and thanks.
    Thanks for sharing the tip, Sadshark… and thanks fungalnet for the clarification.

    Yes, apt and apt-get are not “same thing”. No, apt-get is not “an obsolete turn of phrase”.
    Many of the options available for each of those commands overlap and, confusingly, the default (implicit) apt preferences governing some of those options create “gotcha” traps leading to surprising / unexpected results.

    For instance, we can see a ready example — today, in the MX Linux forum: how to stop apt from deleting downloaded packages

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836598

    Within apt preferences, “Binary::apt::APT::Keep-Downloaded-Packages” controls the behavior of apt
    and “Binary::apt-get::APT::Keep-Downloaded-Packages” controls the behavior of apt-get.

    The implicit “keep” for apt-get is “1” (binary true)
    Because it’s implicit, you won’t notice it if you run apt-config dump so might not even realize such a pref exists.
    The implicit “keep” for apt is “0” (binary false). Again, “gotcha” — if you don’t realize such a pref exists, you wouldn’t know that you can change/override that pref.

    Another potential “gotcha” not yet mentioned in the MX posts:
    Regardless of the apt preferences in effect, when the context is live-boot, or when performing a remaster operation… the persist-save and remaster-live scripts will ignore / discard the contents of the apt cache directory, unless you edit the default provided “excludes” configuration file those scripts consult.

    #11441
    Forum Admin
    Dave
    Dave

    Perhaps I am wrong but is the equivalent of apt-get dist-upgrade not apt full-upgrade?

    Computers are like air conditioners. They work fine until you start opening Windows. ~Author Unknown

    #11442
    Member
    Avatar
    736b69646f6f

    https://manpages.debian.org/stretch/apt/apt.8.en.html

    apt full-upgrade

    full-upgrade performs the function of upgrade but will remove currently installed packages if this is needed to upgrade the system as a whole.

    https://manpages.debian.org/jessie/apt/apt-get.8.en.html

    apt-get dist-upgrade

    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.

    –ignore-hold
    Ignore package holds; this causes apt-get to ignore a hold placed on a package. This may be useful in conjunction with dist-upgrade to override a large number of undesired holds. Configuration Item: APT::Ignore-Hold.

    -y, –yes, –assume-yes
    Automatic yes to prompts; assume “yes” as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package, trying to install a unauthenticated package or removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.

    *if unattended-upgrades is installed / used, a “blacklist” can also workaround any permanently pinned packages
    Unattended-Upgrade::Package-Blacklist { “name_of_pkg”; “name_of_another_pkg”; }

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.