Summary of Apt-get and Apt-cache related commands in Ubuntu

Source: Internet
Author: User

Apt-get is a Linux command for the Deb package managed operating system that is used to automatically search, install, upgrade, uninstall software, or the operating system from the Internet's software warehouse.

The general syntax format for the Apt-get command is:

Apt-cache provides a search function with the following command syntax format:

Note: In the following command, the contents of the angle brackets are determined by the user, such as <pkg> can be replaced with the actual package name Mysql-server.

1. Update or upgrade operation:

Apt-get Update # updates source apt-Get upgrade # update all installed packages apt-get dist-upgrade # Update all installed packages, while upgrading will install new packages to resolve dependencies And Apt-get upgrade does not, in the upgrade, it is recommended to use Apt-get Dist-upgrade

2. Install or reload the class operation:

 Install <pkg> # installation package <pkg>, multiple packages separated by space aptinstall --reinstall <pkg> # Reinstall Package <pkg>aptinstall -F <pkg> # Repair installation (broken dependencies) package <pkg>

3. Uninstall the class operation:

Apt-get Remove <pkg> # Remove package <pkg>(excluding profile) apt-get purge <pkg> # Remove package <pkg> (including profile)

4. Download the Purge class operation:

Apt-get source <pkg> # Download pkg package source code to current directory apt-get download <pkg> # download PKG Package binary package to current directory apt-get Source-d <pkg> # After downloading the source package, compile apt-get build-dep <pkg> # Build the pkg source package's dependent environment (compiling environment? Apt-get Clean # clears the cache (under/var/cache/apt/archives/{, partial}) for all downloaded packages apt-get AutoClean # is similar to clear, But it clears the cache of expired packages (that are no longer downloadable or useless packages) apt-get autoremove # Removes dependencies that are automatically installed due to the installation software, and now does not require a dependency package

5. Query The class operation:

apt-Cache Stats # Displays statistics for system packages apt-cache search <pkg> # Use the keyword pkg search package apt-cache show <pkg_name > # Show Package pkg_name details apt-cache depends <pkg> # view pkg dependent packages apt-cache rdepends <pkg> # View Pkg is dependent on those packages

6. Description of the Software installation directory:

The generic Deb package (including new or apt-get downloads) is/usr/share.

You download the compressed package or compiled package, some can choose to install the directory, generally placed in the/usr/local/, also in the/opt.

7. about the Apt-get cache directory:

The default cache directory is/var/cache/apt/archives/

In order to install the software after reinstalling the system later or to save the download time or to use the package for others, you can compress the package in the directory to save space after compressing the backup.

Reference Link: http://rsljdkt.iteye.com/blog/1142463

Summary of Apt-get and Apt-cache related commands in Ubuntu

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.