Ubuntu – The difference between apt and apt-get

apt

I read about the new fancy progress bar which was added to apt 1.0 in Softpedia and how to enable it here. However on running sudo apt-get update, I did not see the fancy progress bars. On reading the second link again, the solution explicitly requires you to use sudo apt update.

Hence my question is the difference between apt and apt-get. I thought they were one and the same.

Best Answer

  • They are very similar command line tools available in Trusty (14.04) and later. apt-get and apt-cache's most commonly used commands are available in apt.

    apt-get may be considered as lower-level and "back-end", and support other APT-based tools. apt is designed for end-users (human) and its output may be changed between versions.

    Note from apt(8):

    The `apt` command is meant to be pleasant for end users and does not need
           to be backward compatible like apt-get(8).
    

    Take a look at this post for more information on the new tool:

    A synopsis of the above link (with corrections*):

    The big news for this version is that we included a new “apt” binary that combines the most commonly used commands from apt-get and apt-cache. The commands are the same as their apt-get/apt-cache counterparts but with slightly different configuration options.

    Currently the apt binary supports the following commands:

    • list: which is similar to dpkg list and can be used with flags like --installed or --upgradable.
    • search: works just like apt-cache search but sorted alphabetically.
    • show: works like apt-cache show but hide some details that people are less likely to care about (like the hashes). The full record is still available via apt-cache show of course.
    • update: like the regular apt-get update with color output enabled, but apt update also shows the number of upgradeable packages (if any).
    • install,remove: adds progress output during the dpkg run.
    • upgrade: the same as apt-get upgrade --with-new-pkgs.*
    • full-upgrade: a more meaningful name for dist-upgrade.
    • edit-sources: edit sources.list using $EDITOR.
    • policy: works just like apt-cache policy

    You can enable/disable the install progress [bar] via:

    # echo 'Dpkg::Progress-Fancy "1";' > /etc/apt/apt.conf.d/99progressbar
    
  • Related Question