Advanced Package Tool (Debian)
The Advanced Package Tool (APT) is a software manager. First of all, it is a user interface for the installation and removal of software. it works on Debian, Ubuntu and other Linux distributions. In practice, APT retrieves, configures and installs software packages. It can work with pre-compiled files. It can also compile source code as needed.
apt uses the APT library and is the command-line version of the program. There are three common commands: apt, apt-get and apt-cache. These commands are used all the time in the land of Linux. The benefits are simple:
- Perform action on software packages,
- Manage relations between software packages (like dependencies),
- Keep track of software versions and update as needed, and
- Interface with software repositories (both remote and local).
APT is one of the best features of the Debian/Ubuntu system. For instance:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
sudo apt-cache pkgnames # list every package in the system sudo apt-cache show <package> # check package information sudo apt-cache showpkg <package> # list dependencies sudo apt-cache depends <package> # list dependencies (x depends on y) sudo apt-cache rdepends packagename # list reverse depends (y is the depend of x) sudo apt-cache search <search_term> # search cache to find package with <search-term> sudo apt-get clean # Clean repository cache for download manager sudo apt-get update # Update repository cache sudo apt-get upgrade # Upgrade packages and dependencies sudo apt-get dist-upgrade # upgrade Ubuntu distro with package replacements sudo apt-get build-dep <package> # get build dependencies for a package sudo apt-get upgrade -f # fix or upgrade inconsistent/incomplete packages sudo apt-file search <filename> # search repositories with filename for package sudo apt-file list <package> | more # list all files in a package sudo dpkg -L <package> # is a package installed? list files in <package> sudo apt-get check # update package list; check broken dependencies sudo apt-get -u install <package> # upgrade a specific package only sudo apt-get -f install <package> # fix broken packages with dependencies sudo apt-get autoclean # remove .deb files for packages no longer installed sudo apt-get autoremove # remove packages no longer needed sudo apt-get dist-upgrade # upgrade distribution sudo apt-get remove <package> # remove an installed package sudo apt-get purge <package> # remove package and configuration files (best!!) sudo add-apt-repository ppa:<repo.name> # add repository <repo.name> to /etc/apt/sources.list sudo add-apt-repository --remove ppa:<repo.name> ## remove repository sudo apt-key del <number> # delete an expired repository key dpkg -L <package> # list all files installed by a package dpkg -S /path/to/file # find which package provides a file ##-----------------------------------------------------------------------------------------## |