While I napped, we got a new apt – Debian apt command cheat sheet

aptI’m now awake, everyone!  I must have been asleep (and perhaps you were too) since the Debian apt ecosystem now includes an “apt” binary that vastly improves the way we interact with the Debian package management ecosystem.  You can now use the single apt executable instead of apt-get, apt-cache, etc. for many common use cases.  These are groundbreaking changes for the better! My hope is that this post will accelerate your productivity whether you are using Ubuntu, Raspbian, or one of the many other other Linux distros based on Debian.

Scenario: You want to install the cowsay package because you know that a Linux system is not complete without it. 🙂


Given this context, let’s get started using the new, simplified apt binary:

apt update

Updates the local APT package index, a database of available packages available from the central Debian repositories configured for your machine.  It is a good idea to run this command periodically, especially before installing packages or doing upgrades.  You will probably need to add a “sudo” before this command since higher privileges will be required to complete this operation.

apt list cow*

List all packages (whether installed on your system or not) containing the word “cow” followed by anything.  If you run “apt list cow", it will only find packages with an exact match of “cow”.

apt search cow

Searches for “cow” in both package names and descriptions and returns the package name and a brief description.  Note that you don’t need to use a wildcard with this command since it will find “cow” contained in strings such as “cowsay” and “cowbell”.

apt show cowsay

Shows package details including a detailed description. You can use wildcards, but this command works best if you specify the exact package name obtained from a command such as apt list above.

The following commands will most likely need to be prepended with “sudo“.  I am not including “sudo” to avoid line noise so we can focus on the essence of each of the commands.

apt install cowsay

Installs the cowsay package. As a bonus, the new apt command also includes a progress bar in your terminal so you can more easily visualize progress.

apt remove cowsay

This command will remove the cowsay package.  I’m not sure why you’ve ever want to remove this very essential package though. 😉

apt full-upgrade

This command upgrades your system by removing, installing, and upgrading packages.  This is typically the command most people will want to run to get their systems up to date.  It is often used with the “apt update" command and can be combined into one command as follows if you want to show off your command line prowess:

sudo apt update && sudo apt full-upgrade

apt upgrade

This command upgrades your system by installing and upgrading packages.  It will automatically install, but will not remove any packages.  The apt full-upgrade discussed previously will be the command of choice for most in doing upgrades.


With these simple commands above as a reference, you should be able to accomplish 99% of what you need to work with packages in the Debian Linux world.  Spread the word about these new apt command options.  They are quite handy!

Follow @thisDaveJ on Twitter to stay up to date on the latest tutorials and tech articles.

Related Articles

Beginner’s Guide to Installing Node.js on a Raspberry Pi

3 thoughts on “While I napped, we got a new apt – Debian apt command cheat sheet

    1. Great question! Surprisingly, there does not appear to have been a big announcement. I found this post from 2014 that describes some details of the “new” apt binary.

Leave a Reply

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