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