Pin Me

How to Install Via Command Line in Ubuntu

written by: •edited by: Lamar Stonecypher•updated: 7/27/2009

Beginners to Ubuntu and Linux in general are often mystified by how to actually install things via the command line. This article explains the basics of using APT, and in particular, apt-get, to install any package you might want.

  • slide 1 of 3

    APT: Advanced Package Management

    The primary, default way to install things via command line is with the Advanced Packaging Tool, or APT. As with most things in Linux, this is free and open source.

    APT is a general package manager, meaning it can install not only programs such as Skype or GIMP, but also individual packages. APT is also not a single “program,” but rather, a set of many tools and the associated libraries.

    APT is not limited to Ubuntu. It can be used on virtually every Linux distro—it originated on Debian—in addition to many Unix distros. They've even managed to port it onto operating systems such as the one that the iPhone uses in the form of Cydia!

    The APT libraries are also used by many front-end programs to fetch and install programs and packages, such as Aptitude or Ubuntu's own Synaptic. (Technically speaking, APT itself is a front-end program of dpkg, another command line interface)

  • slide 2 of 3

    apt-get commands

    Installing individual packages is the most common command that you'll be using with APT. Type in “apt-get install”, a single space, and then the package name. That's it, that easy.

    Similarly structured are the “update” and “upgrade” commands, which can be used to, well, update or upgrade your entire system if you so desire. It's a good idea to run “update” before “upgrade”, just in case your package index gets confused during this process. During this process, none of the old packages are removed, even if you aren't using them anymore.

    If you want to upgrade the whole distro on your computer, then it's just “apt-get dist-upgrade”, no matter what version you're running.

    Feel like removing a package? APT can do that too. Simply type in “apt-get remove”, and then the name of the package you want to remove. If you want to completely remove all files regarding the package, such as the configuration files, then add in “--purge” to the command, so, “apt-get --purge remove” and then the name of the package.

    If you want to remove AND install or update a package at the same time, there's a way to do that too. If you add a “+” after a package name, it will invert the meaning of the entire command for just that package. So, using the previously mentioned programs as an example, if you want to remove Skype but install GIMP, you can type in, “apt-get remove skype gimp+”.

    After typing any command, you'll be informed of exactly which packages will be installed, how much data will be fetched, and how much space this will take up on your hard drive once the packages have been unpacked, and you'll be prompted on whether you want to continue on.

    To complete any of these commands, apt-get will have to fetch the package from the Ubuntu repositories online. Thus, you'll need an Internet connection to use any of these commands.

    It's really just that easy! Command line installs are nothing to be afraid of.

  • slide 3 of 3

    For More Information

    Confused? Need more details? There are lots of little ways to tweak apt-get to do exactly what you want it to do, from installing a package from a source other than the Internet to installing a specific version of a package, which can be incredibly powerful tools for any user.

    Your best source of information on APT is already on your computer—the man pages, or manual pages. Simply type in “man apt”, or whatever other command or package you may be curious about, and you can get a complete list of the command nuances, including how to use them.

    Want something a little less concise? There are plenty of online materials on the particulars of APT, courtesy of your fellow Linux users. Check out this guide on package management from to get yourself started.