How to use apt-get on debian or ubuntu systems

The advanced package tool, also known as APT is a tool that is used for the easy installation, removal and upgrading of software on Debian/Ubuntu systems.

Things that I will show you how to do:

  • Search for packages using apt-get
  • Update system package lists
  • Upgrade software packages
  • Install and remove specific software packages
  • Check for broken dependencies

Search for packets that you would like to install using apt-get

This command can be used to search for packets and find the specific name so that it can be installed. It also gives a short description on what each piece of software is.

$ sudo apt-cache search
$ sudo apt-cache search google-chrome
Search for packets that you would like to install using apt-get

Update system package lists

This command downloads the package lists from the repositories to get info on the new packages available.

$ sudo apt-get update
Update system package lists

Upgrade software files

This searches for any updated software that is currently installed on your computer.sudo apt-get upgrade.

Upgrade software files

Install and remove specific packages

Installing a specific package:

$ sudo apt-get install [package name]
Install and remove specific packages

Removing a specific package:

$ sudo apt-get remove [package name]

This removes just the package.

Purge remove a package:

$ sudo apt-get purge [package name]
Purge remove a package

This removes the config files and the package.