Linux Comm Apt
apt (Advanced Packaging Tool) is a Shell front-end package manager for Debian and Ubuntu.
The apt command provides commands to find, install, upgrade, and delete a single package, a group of packages, or even all packages. The commands are concise and easy to remember.
The apt command requires super administrator privileges (root) to execute.
### apt Syntax
apt [package ...]
* **options:** Optional, options include -h (help), -y (answer "yes" to all prompts during installation), -q (do not show installation progress), etc.
* **command:** The operation to perform.
* **package**: The package name to install.
* * *
## apt Common Commands
* List all updatable packages command: sudo apt update
* Upgrade software packages: sudo apt upgrade
List updatable packages and version information: apt list --upgradable
Upgrade software packages, remove packages that need to be updated first: sudo apt full-upgrade
* Install specified package command: sudo apt install
Install multiple packages: sudo apt install
* Update specified package command: sudo apt update
* Show detailed package information, such as: version number, installation size, dependencies, etc.: sudo apt show
* Remove package command: sudo apt remove
* Clean up unused dependencies and library files: sudo apt autoremove
* Remove packages and configuration files: sudo apt purge
* Find package command: sudo apt search
* List all installed packages: apt list --installed
* List version information for all installed packages: apt list --all-versions
### Examples
View some updatable packages:
sudo apt update
!(#)
Upgrade packages:
sudo apt upgrade
!(#)
In the above interactive input, enter **Y** to start the upgrade.
You can combine the following two commands for one-click upgrade:
sudo apt install mplayer
!(#)
If you don't remember the full package name, you can enter only the first part of the package name and press Tab key to list related package names:
!(#)
In the above example, we entered **reds** and pressed Tab key, which output four related packages.
If we want to install a package, but if the package already exists, do not upgrade it, we can use the --no-upgrade option:
sudo apt install --no-upgrade
Install mplayer, do not upgrade if it exists:
sudo apt install mplayer --no-upgrade
!(#)
If you only want to upgrade, not install, you can use the --only-upgrade parameter:
sudo apt install --only-upgrade
Only upgrade mplayer, do not install if it doesn't exist:
sudo apt install mplayer --only-upgrade
!(#)
If you need to set a specific version, the syntax is as follows:
sudo apt install =
**package_name** is the package name, **version_number** is the version number.
To remove a package, you can use the remove command:
sudo apt remove mplayer
!(#)
Find packages related to libimobile:
apt search libimobile
!(#)
View information about the pinta package:
apt show pinta
!(#)
List updatable packages:
apt list --upgradeable
!(#)
Clean up unused dependencies and library files:
sudo apt autoremove
!(#)
In the above interactive input, enter **Y** to start the cleanup.
YouTip