In Linux, Apt is a command line utility used to install, update, remove and manage deb packages on Ubuntu, Debian and related Linux distributions. apt is designed for interactive use, Apt is used with deb-based packages, where deb is a packaging format created for and used by the dpkg package management tool.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
What does apt mean in linux
Apt or Advanced Package Tool is used to manage software packages on Linux distributions Tool or application. In Linux terminology, packages are applications, libraries, tools similar to programs on Windows. Linux distributions often use centralized repositories to install and update applications whose packages are provided by these repositories.
APT is mainly used in deb-based distributions, such as Ubuntu, Debian, Mint, Kali, etc. APT is tightly integrated with these distributions and can even be used with other package management software.
apt package manager was created in March 1998 and has been used for more than 20 years. The latest version is 1.8 as package management does not bring new features.
In simple words:
apt is a command line utility for installing, updating, removing and managing deb on Ubuntu, Debian and related Linux distributions software package.
apt is designed for interactive use. It's better to use apt-get and apt-cache in a shell script as they are backwards compatible between versions and have more options and features.
Apt and Dpkg relationship
Apt is used with deb-based packages, where deb is created for and used by the dpkg package management tool The packaging format of the dpkg software package management tool. dpkg and Apt are tools used to work with each other where dpkg is used locally by providing the package name and installation location or the name to be removed whereas apt is a network or internet based tool which will update, search, download and Resolve package dependencies on other package repositories using the Internet. The installation is done in the background by dpkg.
Using the apt command in Linux
apt is designed for interactive use. Prefer apt-get and apt-cache in your shell scripts as they are backwards compatible between versions and have more options and features.
Most apt commands must be run as a user with sudo privileges.
Update Package Index (apt update)
The APT package index is basically a database that holds records of packages available in the repositories enabled in the system.
To update the package index, run the following command. This will pull the latest changes from the APT repository:
sudo apt update
Always update the package index before upgrading or installing new packages.
Upgrade package (apt upgrade)
Regularly updating the Linux system is one of the most important aspects of the security of the entire system.
To upgrade installed packages to the latest version, run:
sudo apt upgrade
This command will not upgrade packages that require removal of installed packages.
If you want to upgrade a single package, pass the package name:
sudo apt upgrade package_name
It is always a good idea to configure automatic security updates.
Full upgrade (apt full-upgrade)
The difference between upgrade and full-upgrade is that if the entire system needs to be upgraded, the latter will remove the installed software package.
sudo apt full-upgrade
Use extreme caution when using this command.
Installation package (apt install)
Installing a package is as simple as running the following command:
sudo apt install package_name
If you want to install multiple packages, please They are specified as a space-separated list:
sudo apt install package1 package2
To install a local deb file, provide the full path to the file. Otherwise, the command attempts to retrieve and install the package from the APT repository.
sudo apt install /full/path/file.deb
Remove package (apt remove)
To remove an installed package, type the following
sudo apt remove package_name
You can also specify multiple Packages, separated by spaces:
sudo apt remove package1 package2
The remove command will uninstall the given package, but it may leave some configuration files behind. If you want to remove a package that includes all configuration files, use purge instead of remove:
sudo apt purge package_name
Remove unused packages (apt autoremove)
Whenever you install dependencies on other packages on your system When a new package is installed, the package dependencies are also installed. After removing the package, the dependencies will remain on the system. These remaining packages are no longer used by anything else and can be deleted.
To remove unnecessary dependencies, use the following command:
sudo apt autoremove
View package list (apt list)
The list command allows you Lists available, installed and upgradeable packages.
To list all available packages, use the following command:
sudo apt list
This command will print a list of all packages, including information about the package's version and architecture. To determine whether a specific package is installed, you can use the grep command to filter the output.
sudo apt list | grep package_name
Only list installed packages, please enter:
sudo apt list --installed
在实际升级软件包之前获取可升级软件包列表可能很有用:
sudo apt list --upgradeable
搜索包 (apt search)
此命令允许您在可用包列表中搜索给定包:
sudo apt search package_name
如果找到,该命令将返回名称与搜索词匹配的包。
查看包的信息 (apt show)
在删除或安装新软件包之前,有关软件包依赖性,安装大小,软件包源等信息可能很有用。
要检索有关给定包的信息,请使用以下 show 命令:
sudo apt show package_name
相关推荐:《Linux视频教程》
The above is the detailed content of What does apt mean in linux. For more information, please follow other related articles on the PHP Chinese website!