Linux-Summary of APT commands

Source: Internet
Author: User

1.How apt works

APT uses a file to list the image site addresses of available software packages. This file is/etc/APT/sources. List.APT is a client/server system. Copy all RPM packages on the server (including upgrade packages from the original CD and RedHat), and then use the apt Analysis Tool (genbasedir) based on the header of each RPM package) analyzes all RPM packages and records the analysis results in one file. This file is called the RPM index list. The RPM index list of the apt server is placed in the base folder. Once the RPM on the apt server changes, you must use genbasedir to generate a new RPM index list. When installing or upgrading the client, you must first query the RPM index list to obtain all dependent software packages and download them to the client for installation.
When the client needs to install, upgrade, or delete a software package, the client computer obtains the RPM index list compressed file and decompress it to/var/State/APT/lists /, when the client uses the apt-Get install or apt-Get upgrade command, it compares the data in this folder with the RPM database in the client computer, know which RPM has been installed, not installed, or can be upgraded.

 

2. APT installation directory

Download path: After apt-Get is downloaded, the software path is/var/Cache/APT/archives.

The default path for Ubuntu is

Path =/home/Brightman/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: /usr/games

The apt-Get install installation directory is determined by the package maintainer.It is not set by the user.

$ Dpkg-l packagename

The name of the dpkg-L + package. You can find out which files are included in the package.

System Installation Software is generally in/usr/share, executable files are in/usr/bin, and configuration files may be installed under/etc.
Documents are generally stored in/usr/share
Executable File/usr/bin
Configuration file/etc
Lib file/usr/lib

 

3. Common commands

Apt-cache search # -- (package search package)
Apt-Cache show # -- (package obtains package information, such as description, size, and Version)
Sudo apt-Get install # -- (package installation package)
Sudo apt-Get install # -- (package--reinstall re-installation package)
Sudo apt-get-F install # -- (Force install? # "-F =-fix-missing" is to fix and install it ...)
Sudo apt-Get remove # -- (delete a package)
Sudo apt-Get remove--Purge # -- (delete a package, including deleting a configuration file)
Sudo apt-Get autoremove-Purge # -- (package deletes packages and their dependent package configuration files (only valid for 6.10, it is strongly recommended ))
Sudo apt-Get update # -- update source
Sudo apt-Get upgrade # -- Update installed packages
Sudo apt-Get dist-upgrade # --- upgrade the system
Sudo apt-Get dselect-upgrade # -- upgrade with dselect
Apt-Cache depends # --- (package understands dependencies)
Apt-Cache rdepends # -- (does package know a specific dependency? # Check which packages the package depends on ...)
Sudo apt-Get build-dep # -- (package installation related compilation environment)
Apt-Get source # -- (package downloads Source code )
Sudo apt-Get Clean & sudo apt-Get autoclean # --- clear the archive of downloaded files & only clear outdated packages
Sudo apt-Get check # --- check for corrupted Dependencies
Apt-Get install # -- (download and install or upgrade all dependent packages at the same time. If a package is set to hold (stop flag, it will be put aside (that is, it will not be upgraded ). For more information about hold, see the following .)
Apt-Get remove [-- purge] # -- (remove and any other packages that depend on this package .)
-Purge indicates that the package should be completely purged (purged). For more information, see dpkg-P.
Apt-Get update # -- (upgrade the package list from the Debian image. If you want to install any software on the day, run it at least once a day and modify/etc/APT/sources each time. after list, it must be executed .)
Apt-Get upgrade [-u] # -- (upgrade the installed package to the latest available version. Old packages will not be installed or removed. Front-end (some of which must be installed before use ).

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.