FactorPad
Build a Better Process

Linux apt-get Command Summary with Examples

Linux apt-get allows you to manage software packages.
  1. Purpose - Learn what apt-get is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with apt-get.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 24, 2021
In this tutorial on Linux apt-get, 65 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / apt-get-command.html


An ad-free and cookie-free website.


Examples of the Linux apt-get Command

Beginner

Learn to manage software packages at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux apt-get Command Summary with Examples (3:42)

Video Script

The Command and Why You Need It

Our sixty-fifth word, or command to memorize is apt-get from our category System.

apt-get allows you to manage software packages.

Common Linux apt-get Options
-options description
--help Print help screen
-d Download archives only
-y Assumes yes to queries

Recall from the last video on dpkg we kicked off a high-level discussion on package management. Well here we'll focus on another tool used to update software directly from Internet repositories.

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The apt-get command has over 30 options and the argument is typically the software package name. The command syntax here is two layers: apt-get [-options] update, apt-get [-options] upgrade, apt-get [-options] install package name.

Like most commands, help is available with double-dash --help. The -d option downloads archives only, and -y assumes 'yes' to all queries that come to the user.

We'll keep it basic as these tasks are often left to administrators. Make note, separate commands apply to two types of Linux distributions, Debian-style is apt-get, here, and for Fedora it's yum.

So why is apt-get an important command? Well, accessing online repositories is a vital task. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go. Let's keep it simple here and view the 15 different commands run within apt-get by redirecting the apt-get --help screen to a file called video65.txt.

$ apt-get --help > video65.txt

And then last, let's view it in less.

$ less video65.txt
apt 1.0.9.8.4 for amd64 compiled on Mar 12 2016 13:31:17 Usage: apt-get [options] command apt-get [options] install|remove pkg1 [pkg2 ...] apt-get [options] source pkg1 [pkg2 ...] apt-get is a simple command line interface for downloading and installing packages. The most frequently used commands are update and install. Commands: update - Retrieve new lists of packages upgrade - Perform an upgrade install - Install new packages (pkg is libc6 not libc6.deb) remove - Remove packages autoremove - Remove automatically all unused packages purge - Remove packages and config files source - Download source archives build-dep - Configure build-dependencies for source packages dist-upgrade - Distribution upgrade, see apt-get(8) dselect-upgrade - Follow dselect selections clean - Erase downloaded archive files autoclean - Erase old downloaded archive files check - Verify that there are no broken dependencies changelog - Download and display the changelog for the given package download - Download the binary package into the current directory Options: -h This help text. -q Loggable output - no progress indicator -qq No output except for errors -d Download only - do NOT install or unpack archives -s No-act. Perform ordering simulation -y Assume Yes to all queries and do not prompt -f Attempt to correct a system with broken dependencies in place -m Attempt to continue if archives are unlocatable -u Show a list of upgraded packages as well -b Build the source package after fetching it -V Show verbose version numbers -c=? Read this configuration file -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp See the apt-get(8), sources.list(5) and apt.conf(5) manual pages for more information and options. This APT has Super Cow Powers. video65.txt

See, the 15, let's call them sub-commands. update retrieves the list of packages, upgrade is here, install I mentioned, but also remove, clean, and download.

A Final Tip

Okay now you know how to use apt-get. And you know the syntax for commands, options and arguments.

One last tip about the apt-get command. So next we'll cover an additional tool for Debian systems that helps you find packages.

Okay, thanks for visiting today. I hope this was a helpful introduction to the apt-get command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

This series about high-level summaries. We walk through installations in other tutorials on our YouTube Channel. Connect so you don't lose this valuable resource.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / apt-get-command.html


apt get
apt get commands
apt get update
apt get install
apt get upgrade
sudo apt get
apt get download
apt get clean
apt get search
sudo apt get upgrade
apt get list
linux apt get
apt get linux
debian apt get
install linux
apt list installed packages
apt get examples
apt get tutorial
linux package manager
apt command
install package
software installation linux

A newly-updated free resource. Connect and refer a friend today.