How to manage Ubuntu applications and PPAs via the terminal

If you are new to Ubuntu or the command line here are a few useful software related commands that will help you maintain your system software with just a few key presses.

How To Use The Commands

All of the following commands are executed in the terminal (also known as the CLI), the quickest way to access the terminal is with the keyboard short-cut Ctrl+Alt+t.

NOTE: Commands that begin with 'sudo' will prompt you to enter your user password, this is because the command requires 'root privileges' and ensures that it is not run by an unauthorised user.

Basic Software Commands

sudo apt-get update
Resynchronize the package index files from their sources
sudo apt-get upgrade
Upgrade the installed software to the latest version available in the repository
sudo apt-get install [app-name]
Install an app that is found in the software repository
(Replace [app-name] with the application name you wish to install)
sudo apt-get remove [app-name]
Remove a currently installed app
(Replace [app-name] with the application name you wish to remove)
sudo apt-get autoremove
Remove packages that were automatically installed and are now no longer needed
sudo apt-get autoclean
Clean up the system and remove obsolete packages

For a more in-depth explanation take a look at our FAQ style introduction to apt-get & apt-cache.

Managing External Software Sources (PPAs)

To install an application using the command line, or Ubuntu Software Centre, the application must first be available in your software repository. PPAs (Personal Package Archives) are used add external software packages that are not already available in your software repository.

Basic PPA Commands

CommandDescription
sudo add-apt-repository ppa:[ppa-name]
sudo apt-get update
Add a PPA to your system then resynchronize the package index files from their sources
Replace [ppa-name] with the PPA name you wish to add
sudo apt-get install ppa-purge
Install PPA-Purge (Only necessary for the first time you use the command below)
sudo ppa-purge ppa:[ppa-name]
Remove a PPA including it's installed packages
(Replace [ppa-name] with the PPA name you wish to remove)
apt-cache policy [app-name]
Find out which PPA a package belongs to
(Replace [app-name] with the application name you wish to find out about)