Introduction to Apt

All of these commands must be run as root or with superuser privileges.


apt-get install package_name


apt-get install package_name1 package_name2 package_name3
apt-get build-dep package_name

This command searches the repositories and installs the build dependencies for package_name.


apt-get update

Run this command periodically to make sure your source list is up-to-date or after changing sources list.

apt-get upgrade

This command upgrades all installed packages.

apt-get dist-upgrade

The same as the above, except add the “smart upgrade” checkbox. It tells APT to use “smart” conflict resolution system,
and it will attempt to upgrade the most important packages at the expense of less important ones if necessary.

apt-get check

It does an update of the package lists and checks for broken dependencies.

apt-get -f install

Do this if you get complaints about packages with “unmet dependences”.

apt-get autoclean

This command removes .deb files for packages that are no longer installed on your system.

apt-get clean

The same as above, except it removes all packages from the package cache. This may not be desirable if you have a
slow internet connection, since it will cause you to re-download any packages you need to install a program.


apt-get remove package_name

This command removes an installed package, leaving configuration files intact.

apt-get purge package_name

This command completely removes a package and the associated configuration files.

apt-get autoremove

This command removes packages that were installed by other packages and are no longer needed.


apt-cache search search_term

This command will find packages that include search_term.

apt-cache show package_name

This command shows the description of package package_name.
and other relevant information including version, size, dependencies and conflicts.

dlocate package_name

This command determines which installed package owns package_name.

For more information please visit https://help.ubuntu.com/community/AptGet/Howto