Is 'apt-get' deprecated?

21,691

Solution 1

apt-get is lower level and backwards compatible. apt is better for end-users and doesn't require or contain some extra features in that are present in apt-get.

Both are perfectly fine. apt-get is not deprecated, but your 15.10 installation is :)

Edit: From the man page of 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).

Edit2: apt was designed to fix some of the fundamental dependency flaws in apt-get. As it is a wrapper, apt is therefore higher level, and also loses some backward compatibility and scripting features.

Solution 2

No, apt-get is not deprecated. The man page of apt has this to say about apt vs. apt-get (and apt-cache):

SCRIPT USAGE AND DIFFERENCES FROM OTHER APT TOOLS

The apt(8) commandline is designed as an end-user tool and it may change behavior between versions. While it tries not to break backward compatibility this is not guaranteed either if a change seems beneficial for interactive use.

All features of apt(8) are available in dedicated APT tools like apt-get(8) and apt-cache(8) as well. apt(8) just changes the default value of some options (see apt.conf(5) and specifically the Binary scope). So you should prefer using these commands (potentially with some additional options enabled) in your scripts as they keep backward compatibility as much as possible.

apt also gives a warning that says

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

if it detects there is a pipe. For example:

$ apt show python | grep Package

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Package: python
APT-Sources: http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

As for your questions,

do i have to replace all apt-get commands with apt?

No, you don't have to replace apt-get with apt. Rather if you were using it in scripts, you should stick to apt-get because it has a stable CLI API and guaranteed backward compatibility.

is apt-get dangerous?

apt is as dangerous as apt-get: you should only install software from sources you trust.

can i use apt in Ubuntu 15.10?

Yup, you can. The problem here is you are still using Ubuntu 15.10, which is now unsupported! Please upgrade to 16.04, which is a LTS version.

will my programs still work?

By programs, I assume you mean scripts. Yes, they will still work since apt-get is not deprecated. In fact, you should prefer to use apt-get in scripts for backward compatibility as suggested by apt's man page.

Solution 3

apt and apt-get are basically the same package manager, what they do is the same.

A difference is that apt also contains features from e.g. apt-cache and has a nicer looking output.

However, apt should not yet be used in scripts, at least if you want to parse its output, because it is still in development and its output format may still change. Bash's tab-autocomplete is also not yet working with many apt commands.

You can use both, whichever you prefer.

Share:
21,691
Skybbles
Author by

Skybbles

Updated on September 18, 2022

Comments

  • Skybbles
    Skybbles over 1 year

    Lately, I've seen many people use

    sudo apt
    

    instead of

    sudo apt-get
    

    Also, Ubuntu keeps telling me to install things by sudo apt

    The program 'foo' is currently not installed. You can install it by typing:
    sudo apt install foo
    

    (remember, foo is placeholder, not an app)

    So, after this popularity in the community about using apt instead of apt-get, I'm starting to think that apt-get is deprecated and can no longer be used in my bash programs.

    In my bash programs,

    • do I have to replace all apt-get commands with apt?
    • is apt-get dangerous?
    • will my programs still work?
    • WinEunuuchs2Unix
      WinEunuuchs2Unix over 7 years
      Apt is prettier than apt-get
  • Anwar
    Anwar over 7 years
    What features aren't in apt-get not in apt? And how apt is better for end user?
  • Anwar
    Anwar over 7 years
    Again, apt-get is not lower level than apt. This is a misleading information. apt is on same level as apt-get and apt is nothing but a wrapper around apt-get and apt-cache
  • Anwar
    Anwar over 7 years
    apt provides apt-cache features with added delay! try using apt search package and apt-cache search package. Same using policy
  • Gunnar Hjalmarsson
    Gunnar Hjalmarsson over 7 years
    @Anwar: There are differences. One example: apt upgradeapt-get upgrade, since the former installs new packages, while the latter does not.
  • Tavian Barnes
    Tavian Barnes over 7 years
    @Anwar If apt is a wrapper arount apt-get then it's definitely higher-level.
  • Byte Commander
    Byte Commander over 7 years
    @Anwar I don't see any difference at all using apt(-cache) policy. With apt(-cache) search, there is a difference in speed, yes, but the output of apt is sorted and nicely formatted in return.
  • Sir Robert
    Sir Robert about 6 years
    @Anwar That's actually the definition of being "higher level" or "lower level". apt is higher level because it wraps apt-get. A sort of test is that if your apt got corrupted, apt-get would still work-- but not vice versa.
  • jarno
    jarno almost 5 years
    What are the "the fundamental dependency flaws" in apt-get?