Ubuntu Package Management – Usage of a Few Cases

Ubuntu Linux comes with a good package management system, apt. Once you familiar with it, it is really easy to use.

There’re several front-end interface to this package management system, including aptitude, the command line interface, synaptic, the GUI application for X Window System and apt-get, the command line package handling utility.


  1. Install All Latest Updates
    apt-get update     //refresh available updates
    apt-get upgrade   //upgrade all packages
  2. Install a New Version of Ubuntu
    apt-get update
    apt-get dist-upgrade

Install/Uninstall New Software Packages

  1. If you know the package nameFor installation, enter the following command,
    sudo apt-get install  <pkg>

    For uninstallation, enter the following command,

    sudo apt-get purge  <pkg>


    sudo apt-get remove <pkg>
  2. If you don’t know the package name exactly, use the aptitude search function,
    sudo aptitude search <whatever-what-know>

    The system will return a list of packages, then you can use commands mentioned above to install the package you want.

  3. If there’re broken packages in your system, fix the broken packages by entering the command,
    sudo apt-get -f install


Get the Source Code for Compiling the Software Package

  1. Get the package source code by entering the following command,
    sudo apt-get source <pkg>
  2. Get other packages needed to build this package
    sudo apt-get build-dep <pkg>
  3. If you haven’t installed the build tools yet, install them by entering the command,
    sudo apt-get build-essential
  4. follow the compilation guideline of the package to compile the package. Normally what you’ll need to do is, (in case you don’t have permission for any steps below, add sudo in front)
    cd <pkg-directory>
    make install


Download without Installing Software Package

  1. Sometimes you might just want to download the package and pass it to your friend who doesn’t have a Internet connection,
    sudo aptitude download <pkg>

The .deb installation package will be downloaded to your current directory.


Leave a Reply

Your email address will not be published. Required fields are marked *