Linux: How to Install/Remove Packages

By Xah Lee. Date: . Last updated: .

Here's how to install and remove Ubuntu Linux software packages.

The following are for Ubuntu Linux.

Install Package

sudo apt-get install name
Install a package.

Remove Package

sudo apt-get remove name
Uninstall package.
sudo apt-get purge name
Remove a package and its config files.

Search package

apt-cache search name
Search for a package.

Describe Package

apt-cache show name
Describe package.
apt-get showpkg name
Show a package's dependencies.

List Installed Packages

dpkg -l
List all installed packages

Update All Installed Software

apt-get update
Sync package index files from sources. (need to do this regularly)
apt-get upgrade
Upgrade all installed packages to latest versions (if any).
apt-get dist-upgrade
Update OS kernel, and others.
# update all software (it'll ask to confirm)
sudo apt-get update
sudo apt-get upgrade
sudo apt-get distupgrade

Launch Software Update GUI App

Launch the package manager GUI App

Compile a software from source code

To install and compile a new software from source code , here's the typical steps:

gzip -d filename.tar.gz
tar xvf filename.tar

cd dirname
sudo make install # optional. This basically copy the binary to /usr/local/bin

Example: How to Build Emacs on Linux .