How to Use APT and Say Goodbye to APT-GET in Debian and Ubuntu

Christian Cawley 11-08-2017

Linux is in a state of permanent evolution. Often the changes are hidden, such as behind the scenes developments to the kernel and other underlying code. But occasionally, the user has to adjust to a new way of working.


While many enhancements in computing can be jarring and require a different mindset, this isn’t true of the development of the apt-get command. Rather than replace it completely, Debian-based systems (such as Ubuntu, Linux Mint, and the Raspberry Pi’s Raspbian 5 Ways New Raspbian Jessie Makes Raspberry Pi Even Easier to Use Following the release of Debian Jessie in July, the Raspberry Pi community has been blessed with a new release of the Raspbian variant, based on the "parent" distro. Read More ) are continuing its use alongside its replacement, the simpler apt command.

But why are they doing this, and what has really changed?


There is a sound logic in introducing the apt command. Previously, access to the Advanced Package Tool has been via the apt-get and apt-cache set of commands (or via Synaptic or other package managers Which Linux Package Manager (and Distro) Is Right for You? A key difference between the main Linux distros is the package manager; the differences are strong enough that it can influence your choice of distro. Let's look at how the various package managers work. Read More on the desktop). However, due to the way these have been expanded over time, things have become rather disorganized.

By introducing apt, which features the most commonly used options from apt-get and apt-cache, not only are the commands slightly shorter, there are also fewer of them. This avoids duplication and other problems that have arisen over the years.

But apt isn’t just about unifying two similar, disorganized command structures. It also enhances the command line experience. For instance, a progress bar is displayed when installing or removing a program.


So, that’s why apt was introduced. But why should you use it? These examples explain.

In Short: No More GET

We’ve previously looked at the apt-get command in-depth A Beginner's Guide to Installing Software in Ubuntu with APT If you've used Ubuntu you have probably used the apt command at some point. But did you know there's so much more to it than apt-get install and apt-get upgrade? Read More . The commands you previously used can still be employed, simply by dropping the “-get” portion.


apt-get install [packagename]


apt install [packagename]

In general, this change occurs across all previous apt-get commands. But with the introduction of apt comes some extra functionality. Software upgrades and removal now all have additional options, from installing multiple packages to purging packages from your system.

Get a Full Upgrade

You probably already know about the update and upgrade commands that work with both apt and apt-get. In short, update refreshes the package information from the repositories Your Guide to Ubuntu Repositories and Package Management Read More , while upgrade will upgrade any actually installed packages.

apt full upgrade

The new apt command introduces this new command, full-upgrade.

sudo apt full-upgrade

With this command, not only will the packages be upgraded, any old packages that must be removed as part of the upgrade will be discarded. The standard apt upgrade command doesn’t do this.

Install Multiple Packages

In a rush, and need to install more than one software package? Or simply want more efficiency from your software installation command?

The apt install command has evolved, enabling you to now install multiple packages with a single command. Simply name the packages in turn after the install command:

sudo apt install [package_1] [package_2] [package_3]

If an app is already installed, then apt will check the database for a later version and install this instead. Simple!


Install a Package Without Upgrading

It’s possible that in some circumstances you may need to install an existing package (perhaps to repair it) without upgrading. Fortunately, apt also simplifies this scenario:

sudo apt install [packagename] --no-upgrade

apt no upgrade

Meanwhile, you can download an upgrade to an uninstalled package and leave it uninstalled with:

sudo apt install [packagename] --only-upgrade

Admittedly that last command is an unusual scenario for most, but it’s worth knowing about.

Install a Specific Package Version

What if you wanted a specific version of an application? This might happen if you find that the latest update breaks a feature that you use. You’ll need to perform some research for this, in order to make sure you know the version number of the package.

Once you’ve found it, simply use this command to specify the package name and the intended version:

sudo apt install [packagename]=[version_number]

Remember that subsequent upgrades can undo this and replace the desired version with the latest. As such, you will need to repeat this command (unless the broken feature is restored by the developers).

List Upgradeable and Installed Packages

Another new aspect to installing software with apt on Debian based systems is the list option. This will output a list based on the specified condition.

For instance, you can view a list of packages that have an upgrade pending:

apt list --upgradeable

More simply, a list of installed packages:

apt list --installed

apt list

A third option for list is also available. This will display a list of all packages that are available for your operating system and computer.

apt list ----all-versions

(Notice the number of “-” characters in the command: four!)

Remove vs. Purge

The old method of removing a package with the remove command still works with apt. Use it as a reverse of the installation, specifying the package name:

sudo apt remove [packagename]

However, there is also the purge command, which works in much the same way.

sudo apt purge [packagename]

But what’s the difference?

Well, apt remove simply removes binaries, but this results in residual files being left behind — configuration files, usually.

With apt purge, however, everything related to the files is removed: binaries, config files, the lot.

Cleanup With Autoremove

Commands like remove and purge might be used to discard unwanted software on your system. In the old days of apt-get, more efficient methods of housekeeping would be available using clean and autoclean.

apt autoremove

With apt, there’s just a single function: autoremove. Once entered, this will remove libraries and packages that are installed automatically, usually as dependencies for the desired applications. As long as these packages remain disassociated with required apps, they can be discarded.

sudo apt autoremove

And of course, this will result in important disk space being freed up How to Instantly Free Up Spare Disk Space on Linux With just two commands, you could clean out a lot of junk files that are taking up space on your system. Read More !

New Commands and Better Functionality

With the apt-get command you can update, upgrade, install and remove software on Debian-based Linux operating systems. But with the simpler apt command, you can do so much more!

But which do you prefer? Will you be holding onto apt-get until it is fully deprecated, or do you fully embrace apt? Tell us how you feel — and any commands you think we should have included — in the comments box.

Image Credits: Brian A Jackson/Shutterstock

Related topics: Debian, Linux, Terminal, Ubuntu.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. T.Weeks
    August 28, 2018 at 3:09 am

    So I jumped on and checked out apt.. but I do a lot of install automation.. and the progress indicators and fancy colors just get in the way. When I want to do a package search and see all installed and non-installed packages side by side, in an easy to grep/match/trigger on.. I turn to aptitude.

    Compare the useful, old format (when searching for any package with "vim" in the name:
    # aptitude search vim | head -50
    p vim-bitbake - Vim plugin to interact with Yocto bitbake-based recipes
    p vim-command-t - open files with a minimum number of keystrokes
    i vim-common - Vi IMproved - Common files
    p vim-conque - plugin for running interactive commands in a Vim buffer
    p vim-ctrlp - fuzzy file, buffer, mru, tag, etc. finder for Vim
    p vim-doc - Vi IMproved - HTML documentation
    p vim-editorconfig - EditorConfig Plugin for Vim
    v vim-erlang -
    v vim-erlang-syntax -
    p vim-fugitive - Vim plugin to work with Git
    p vim-gnome - Vi IMproved - enhanced vi editor (dummy package)
    p vim-gocomplete - gocode integration for Vim
    i A vim-gtk - Vi IMproved - enhanced vi editor - with GTK2 GUI
    p vim-gtk3 - Vi IMproved - enhanced vi editor - with GTK3 GUI
    i A vim-gui-common - Vi IMproved - Common GUI files
    p vim-haproxy - syntax highlighting for HAProxy configuration files

    To the crappy new, useless output format:
    # apt search vim | head -50
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    Full Text Search...
    acr/kali-rolling 1.6.1-1 all
    autoconf like tool
    alot/kali-rolling 0.6-2.1 all
    Text mode MUA using notmuch mail
    alot-doc/kali-rolling 0.6-2.1 all
    Text mode MUA using notmuch mail - documentation
    apvlv/kali-rolling 0.1.5+dfsg-3 amd64
    PDF viewer with Vim-like behaviour
    bicyclerepair/kali-rolling 0.9-6.2 all
    A refactoring tool for python
    bleachbit/kali-rolling 2.0-2 all
    delete unnecessary files from the system
    cernlib-base/kali-rolling 20061220+dfsg3-4.3 all
    CERNLIB data analysis suite - common files
    clang-format-3.9/kali-rolling 1:3.9.1-19 amd64
    Tool to format C/C++/Obj-C code
    clang-format-4.0/kali-rolling 1:4.0.1-10 amd64
    Tool to format C/C++/Obj-C code

    Wow.. none of those packages even have anything to do with vim. Plus.. they don't tell me what KIND of package it is and its state (installed, etc).

    As soon as I saw the weird new (unusable) output from apt, I was like, awww. hell no..".. Back to aptitude for me thanx.. It even WARNS you not to use it in scripts:

    # apt search vim |grep "/" | wc -l
    WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
    # aptitude search vim | wc -l

    No thanks!



  2. KP
    August 13, 2017 at 1:01 pm

    Thanks. This is good information for an occasional user like me.

  3. Jarno Suni
    August 13, 2017 at 8:27 am

    I think this is badly written article. Only subset of the commands are available at least in Ubuntu Trusty. I do not see how "apt full-upgrade" differs from "apt-get dist-upgrade". Or "apt autoremove" from "apt-get autoremove". "----all-versions" does not work. Why would there be four dashes as option prefix anyway? I use apt-get in some scripts and except them to work for long time. Manual page of apt tells apt is not for scripts so there is no reason to say goodbye to apt-get.

  4. fcd76218
    August 11, 2017 at 10:26 pm

    Your article offers only a teaser preview of 'apt'. Where can I find a manual or a extensive writeup on 'apt'? All I find on the 'Net are writeups for 'apt-get/apt-cache'.

    From what you wrote it seems that 'apt' is a CLI port of Synaptic. As long as Synaptic is available, I'd rather use it than any command line application.

    • nigratruo
      August 14, 2017 at 2:18 pm

      You can look what apt can do with
      man apt

      I'm a little shocked at this article. Not to be overly critical (thanks for writing the article pointing apt out), but the author does not seem to know what apt-get can do and what place it has:
      Installing several packages has ALWAYS been part of apt-get, as far as I can remember back with Debian (2002), it is not a correct comparison.
      Also, apt-get is not going away, it will be still available and also, sadly, I have found that apt can't do all the things that apt-get can, so it won't be a permanent replacement for us power users. (kind of silly if you still need another command, because one can't do it all).
      I have to say that I like the progress bar and the more user friendliness, but CLI has always been about power, not about dumbing down, so I wonder how that will work.
      Synaptic by the way is a GUI frontend, apt-get and apt are CLI commands, Synaptic is based on apt-get / dpkg, not the other way around. Or otherwise said: Synaptic would not work without dpkg / apt-get, while apt-get / dpkg can run very well without synaptic.

  5. William Vasquez
    August 11, 2017 at 8:42 pm

    Please, let me know if there is anything that 'apt-get' is better at doing than 'apt'.