apt-get is the command-line driven interface which powers the aptitude package manager on Debian-based Linux distributions (including Ubuntu and other derivatives).
Using apt
Use apt-get to install new packages, upgrade installed packages, and remove packages.
To locate package names, use apt-cache search <search_string> (where <search_string> is the partial name of the package) or visit the project website for your distribution.
Note: Running apt-get requires root privileges - use sudo if you are not logged in under the root user account.
Before installing new packages, enter apt-get update to request the latest lists of available packages from repositories specified in your /etc/apt/sources.list file.
Basic apt-get Functions
- apt-get update - Update the list of available packages from the repositories listed in the /etc/apt/sources.list file
- apt-get install <package_name> (where <package_name> is a valid package name) - Install a package and any packages which it depends upon
- apt-get upgrade - Upgrade all packages which can be upgraded
- apt-get remove <package_name> (where <package_name> is a valid package name) - Remove a package and any packages which depend upon it
Advanced apt-get Functions
- apt-get dselect-upgrade - Integrates with the traditional Debian packaging front-end dselect
- apt-get purge - Identical to remove, but the package gets purged as well
- apt-get source - Fetches a source package instead of a binary package
- apt-get build-dep - Fetches only the build dependencies for a given package, so it can be built from source
- apt-get check - Updates the package cache, and checks for broken dependencies
- apt-get clean - Clears out the local repository of retrieved packages. Clears up some space taken by these files, which probably won't be needed again
- apt-get autoclean - Like clean, but less aggressive
- apt-get autoremove - Removes packages that are no longer needed
- apt-get dist-upgrade - Perform an upgrade while intelligently handling changing dependencies and "smart" conflict resolution
Help and Manual
Enter apt-get help to view all command-line options, or enter man apt-get to view the manual.
Related Commands