817

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.

nik90
  • 12,609
  • 1
    AFAIK they are only available in Trusty. Here is how to enable them: http://askubuntu.com/questions/445245/how-do-i-enable-fancy-apt-colours-and-progress-bars – Seth Apr 11 '14 at 15:04
  • 22
    given that @Seth 's comment is almost 2 years old, I thought I would add now that it is available, installed and usable out of the box. Nothing is required to enable them, just use apt instead of apt-get (I'm on 15.10) – Madivad Feb 25 '16 at 23:21
  • 2
    apt-get is legacy command and new version is apt. – Salman Amintabar Jun 17 '20 at 19:12
  • 3
    @SalmanAmintabar apt-get is not legacy, it should be using in script. apt is better for the user – KetZoomer Mar 29 '21 at 00:00

4 Answers4

685

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
Mario Limonciello
  • 7,014
  • 1
  • 14
  • 3
  • 3
    Just curious - isn't apt upgrade equivalent to 'upgrade --with-new-pkgs' (instead of dist-upgrade which IIRC does it by default and also removes)? – zeratul021 Apr 30 '16 at 20:10
  • Strangely apt upgrade gives me an error where apt-get upgrade only prints a warning when a PPA does not have a Release file. – Tor Klingberg Nov 15 '16 at 17:00
  • 1
    That blog post is mistaken to say apt upgrade is like apt-get dist-upgrade --with-new-pkgs. dist-upgrade can install new packages and can remove them. UI aside, apt upgrade is apt-get upgrade --with-new-pkgs. See JungleMartin's answer and apt(8) on upgrade: "New packages will be installed if required to satisfy dependencies, but existing packages will never be removed." – Eliah Kagan Aug 11 '17 at 14:20
  • 8
    May be worth mentioning that starting in 16.04 by default apt does not save the downloaded packages while apt-get does. – doug Oct 03 '17 at 10:54
  • Another nicety of apt if you have installation running already, and you execute apt-get install foo, it will bail out with E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend). apt on the other hand will block with an interactive timeout counter till the other installation process is finished. – Hi-Angel Feb 19 '21 at 15:11
  • @Hi-Angel: Was one of the "apt" in your last comment meant to be an "apt-get"? – EricS Apr 06 '21 at 06:07
  • @EricS I don't think so. I don't remember details, but judging by the content of the comment, the "installation running" might be by anything: apt, apt-get, plain dpkg. That is because the lock /var/lib/dpkg/lock-frontend is the dpkg lock. And then I describe the difference in behavior, where apt just blocks till installation finishes, whereas apt-get bails out. – Hi-Angel Apr 06 '21 at 06:16
  • apt: WARNING: apt does not have a stable CLI interface. Use with caution in scripts. – Maxim Egorushkin Sep 13 '21 at 12:07
  • what is the (8) in the answer? – Gulzar Nov 21 '21 at 17:01
  • 1
    @Gulzar it indicates the section of the manual in which the command is explained. In this case it's Section 8: administration and privileged commands – kikones34 Mar 07 '22 at 08:13
  • To add to what kikones34 said: the man(1) command can take a second (or rather, a first argument ;-)): man 8 apt. This is important if there are two man pages with the same name in different sections. – Jürgen A. Erhard Feb 21 '23 at 12:54
145

As I write this, the apt man page (my apt package version: 1.0.1ubuntu2.8) includes the following section:

DIFFERENCES TO APT-GET(8)
   The apt command is meant to be pleasant for end users and does not need
   to be backward compatible like apt-get(8). Therefore some options are
   different:

   ·   The option DPkg::Progress-Fancy is enabled.
   ·   The option APT::Color is enabled.
   ·   A new list command is available similar to dpkg --list.
   ·   The option upgrade has --with-new-pkgs enabled by default.
muru
  • 197,895
  • 55
  • 485
  • 740
JungleMartin
  • 1,567
  • 1
  • 9
  • 3
  • 6
    This is the correct answer (for Debian and Ubuntu as well as other derivatives like Mint). In particular, running sudo apt upgrade will perform the same operations as sudo apt-get upgrade --with-new-pkgs. It will install new packages but, unlike sudo apt-get dist-upgrade, it will not remove old ones (except when installing a new version of the same package, of course--which sudo apt-get upgrade will also do). man apt further corroborates that this answer is correct. – Eliah Kagan Aug 11 '17 at 14:12
  • I'm rolling back your rollback of my edit because a) your formatting requires unnecessary scrolling, and b) your copied text is incorrect, the option isn't DPkgPM::..., but DPkg::.., as the online manpage shows. – muru Oct 03 '17 at 10:11
  • 15
    bonus points for RTFM – Thufir Oct 26 '17 at 13:29
  • The option "check" doesn't work with apt. I have to use "apt-get check". Why? – Juan Sep 17 '19 at 19:58
  • This answer is (of course, sigh) outdated. In the current version of apt (2.5.6 in unstable), this section isn't present anymore. – Jürgen A. Erhard Feb 21 '23 at 13:00
  • @Juan Because check is very obviously not something an average user should need to use. – Jürgen A. Erhard Feb 21 '23 at 13:00
61

There are various tools that interact with Advanced Packaging Tool (APT) and allow you to install, remove and manage packages in Debian based Linux distributions. apt-get is one such command-line tool which is widely popular. Another popular tool is Aptitude with both GUI and command-line options.

If you have used apt-get commands, you might have come across a number of similar commands such as apt-cache, apt-config etc. And this is where the problem arises.

You see, these commands are way too low level and they have so many functionalities which are perhaps never used by an average Linux user. On the other hand, the most commonly used package management commands are scattered across apt-get, apt-cache and apt-config.

The apt commands have been introduced to solve this problem. apt consists some of the most widely used features from apt-get, apt-cache and apt-config leaving aside obscure and seldom used features.

With apt, you don’t have to fiddle your way from apt-get to apt-cache to apt-config. apt is more structured and provides you with necessary options needed to manage packages.

Bottom line: apt = most common used command options from apt-get, apt-cache and apt-config.

I have written in detail on the difference between apt and apt-get.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
abhishek
  • 2,696
25

APT is a vast project, whose original plans included a graphical interface. It is based on a library which contains the core application, and apt-get is the first front end — command-line based — which was developed within the project.

apt is a second command-line based front end provided by APT which overcomes some design mistakes of apt-get.

Quoted from:

https://debian-handbook.info/browse/stable/sect.apt-get.html

Zanna
  • 70,465
mit
  • 2,121