The apt-get command does not provide the software package management function, but provides a command line platform for software package management.
Use more sub-commands on this platform to complete specific management tasks.
The general syntax format of the apt-get command is:
Sh code
Apt-get subcommands [-d |-f |-m |-q | -- purge | -- reinstall |-B |-s |-y |-u |-h |-v] [pkg]
Apt-cache provides the search function.
1. Update or upgrade operations:
Sh code
Apt-get update # update source
Apt-get upgrade # update all installed packages
Apt-get dist-upgrade # Release Version upgrade (for example, from 10.10 to 11.04)
2. Installation or reinstallation:
Sh code
Apt-get install pkg # install the pkg package. Separate multiple packages with spaces.
Apt-get install -- reinstall pkg # reinstall the software package pkg
Apt-get install-f pkg # Fix installation (broken dependency) package pkg
3. unmount operations:
Sh code
Apt-get remove pkg # Delete the software package pkg (excluding the configuration file)
Apt-get purge pkg # Delete the package pkg (including the configuration file)
4. Download and clear operations:
Sh code
Apt-get source pkg # download the source code of the pkg package to the current directory
Apt-get download pkg # download the Binary Package of the pkg package to the current directory
Apt-get source-d pkg # After downloading the source code package, compile
Apt-get build-dep pkg # build the dependent environment of the pkg source code package (compiling environment ?)
Apt-get clean # Clear all downloaded packages in the cache (under/var/cache/apt/archives/{, partial })
Apt-get autoclean # similar to clean, but it clears expired packages in the cache (that is, packages that cannot be downloaded or are useless)
Apt-get autoremove # Delete dependency packages that are not needed because the software is automatically installed
5. query operations:
Sh code
Apt-cache stats # displays statistics of system software packages
Apt-cache search pkg # Use the keyword pkg to search for software packages
Apt-cache show pkg_name # displays the details of the pkg_name package.
Apt-cache depends pkg # view the software package on which pkg depends
Apt-cache rdepends pkg # Check that pkg is dependent on those software packages
6. Description of the software installation directory:
The general deb package (including new or apt-get download) is in/usr/share.
Some of the compressed or compiled packages can be installed in/usr/local/or/opt.
7. cache directory for apt-get:
The default cache directory is/var/cache/apt/archives/
To save the download time or use the software package after installing the software after the system is reinstalled in the future, you can compress and back up the software package in the directory and clean it up to save space.