From LQWiki
Jump to: navigation, search

apt-get is the command to initialize Debian's native package management utility/application "Apt". This tool has also been ported to a number of other distributions.

You use the apt-get command to install and remove software packages from your system (one at a time or many at once), as well as update your system's internal listing of what packages are available from your currently selected list or repositories.


to install a package:

# apt-get install NameOfPackage

to reinstall a package

# apt-get install --reinstall NameOfPackage

to remove a package:

# apt-get remove NameOfPackage

to remove a package and configuration file:

# apt-get --purge remove NameOfPackage

to search for a package:

# apt-cache search NameOfPackage

to update the repository (list of avalible .deb's):

# apt-get update

to upgrade your system (can be useful in maintaining an up-to-date system):

# apt-get upgrade

to upgrade your distribution (tries to choose packages needed to upgrade your dist):

# apt-get dist-upgrade

to enable smart-tab completion, add the line

source /etc/bash_completion

to your .bashrc file. When you enter a command like "apt-get install a<tab>," bash will auto-complete the entry.

to see a short list of common commands:

# apt-get --help


Try running

apt-get moo
 / |    ||
*  /\---/\
   ~~   ~~

...."Have you mooed today?"...

Using with other distributions

You can go to Freshrpms to find apt-get tools for distributions other than Debian. After apt-get is installed, the command line syntax is the same as that listed above for Debian.

Trouble-shooting with RPM-based distributions

Sometimes apt-get will complain about being unable to lock a specific directory. Many of these problems can be remedied with the following commands.

rm /var/lock/rpm/transaction
rm /var/lib/rpm/__db*
rm /var/cache/apt/archives/lock

See also

external links