How to Install Any Ubuntu Package Using Apt-Get

Ubuntu logo


When people first start to use Ubuntu they will use the Ubuntu Software Manager to install software.

It doesn't take long however before it becomes obvious that the Software Manager isn't actually very powerful and not every package is available.

The best tool for installing the software within Ubuntu is apt-get. It is a command line application which will instantly put some people off but it gives you so much more than any other tool at your disposal.

This guide shows how to find, install and manage applications using the apt-get command.

Open a Terminal

To open a terminal within Ubuntu press CTRL, Alt and T at the same time. Alternatively, press the super key (Windows key) and type "term" into the search bar. Click the icon that appears at the terminal.

Update the Repositories

The software is made available to users via repositories. Using the apt-get command you can access the repositories to list the packages that are available

Before you start searching for packages however you will want to update them so that you get the latest available list of programs and applications.

The repository is a snapshot in time and so as days pass new software versions become available which are not reflected in your repositories.

To keep your repositories up to date run this command before installing any software.

sudo apt-get update

Keep Installed Software Up to Date

It is highly likely that you will use the update manager to keep your software up to date but you can also use apt-get to do the same thing.

To do so run the following command:

sudo apt-get upgrade

How to Search for Packages

Before installing packages you will need to know which packages are available. apt-get is not used for this task. Instead, apt-cache is used as follows:

sudo apt-cache search <package name | keyword>

For example to search for a web browser type the following:

sudo apt-cache search "web browser"

To get more information about a package type the following:

sudo apt-cache show <package name>

How to Install a Package

To install a package using apt-get use the following command:

sudo apt-get install <package name>

To get a full idea of how to install a package try installing Skype

How To Remove A Package

Removing packages is as straightforward as installing packages. Simply replace the word install with remove as follows:

sudo apt-get remove <package name>

Removing a package merely removes the package. It does not remove any configuration files used with that piece of software.

To fully remove a package use the purge command:

sudo apt-get purge <package name>

How to Get the Source Code for a Package

In order to view the source code for a package you can use the following command:

sudo apt-get source <package name>

The source code is placed into the folder where you ran the apt-get command from.

What Happens During the Installation Process?

When you install a package using apt-get a file with a .deb extension is downloaded and placed into the folder /var/cache/apt/packages.

The package is then installed from that folder.

You can clear the folders /var/cache/apt/packages and /var/cache/apt/packages/partial by using the following command:

sudo apt-get clean 

How to Reinstall a Package

If an application you are using suddenly stops working then it might be worth attempting to reinstall the package in case something has been corrupted somehow.

To do this use the following command:

sudo apt-get install <package name> --reinstall


This guide shows a summary of the most useful commands required to install packages using the command line within Ubuntu.

For a full usage, summary read the man pages for apt-get and apt-cache. It is also worth checking out the man pages for dpkg and apt-cdrom.