apt provides a high-level CLI (Command Line Interface) for the package management system and is intended as an interface for the end user which enables some options better suited for interactive usage by default compared to more specialized APT tools like apt-cache and apt-get.
apt [...COMMANDS] [...PACKAGES]
Most Used Commands:
- update : This command is used when we want to download package information from all configured sources.
- upgrade : This command is used when we want to install available upgrades of all packages currently installed on the system from the sources configured via sources.list. If new packages are required to satisfy dependencies, they will be installed, but already existing packages will never be removed. If for a package to be upgraded, the removal of an installed package is required, the upgrade will not be performed.
- full-upgrade : This command has a functionality similar to upgrade but if to upgrade the system as a whole, if the removal of already installed packages is required, then it will remove them.
install : This command performs the action of installation on one or more packages specified via regex, glob or exact match. The user can select a specific version of the package to be installed by following the package name with ‘equals’ sign and specifying the version number. Also, the user can specify the version from a specific release by following the package name with a forward slash (/) and the codename (stretch, buster, sid, etc.) or the suite name (stable, testing, unstable).
apt install [...PACKAGES]
- remove : This command is similar to
installcommand, the only difference being that the
removecommand removes the packages instead of installing them.
apt remove [...PACKAGES]
- purge : This command is similar to
removecommand, the only difference being that the
purgecommand also removes any configuration files related to the removed packages.
apt purge [...PACKAGES]
- autoremove : This command is used when the user wants to remove the packages that were installed as dependencies to previously installed packages, and are no longer required by the system, as the packages which required them as dependencies were removed, or the dependencies were changed. The packages which the user explicitly installs via
apt installare never proposed for automatic removal.
- search : This command is used when the user wants to search for the given regex term(s) in the list of available packages and display matches. For example, this command can be useful when you want to search for packages having a specific feature.
apt search [...REGEX]
- show : This command is used when the user wants to display information regarding packages like it’s dependencies, download and installation size, the sources from which the package is available, the package’s content’s description and more. It can be helpful to display the information before the user removes the package, or while searching for a package to install.
apt show [...PACKAGES]
- list : This command is used to display a list of packages that satisfy a certain criteria. It is similar to dpkg-query –list in that manner. It has a support for glob patterns for matching the package names and options to list the installed (–installed), upgradeable (–upgradeable) or all-available versions (–all-versions).
apt list [--installed/--upgradeable/--all-versions]
- edit-sources : This command lets you edit your sources.list files in your preferred text editor and also provides basic sanity checks.