Apt-get command in Ubuntu Linux system

Source: Internet
Author: User
Tags pack

Apt-get command in Ubuntu Linux system (Via|via)

Common APT Command parameters:
 
Apt-cache Search Package
 
Apt-cache Show package for information about packages, such as description, size, version, etc.
 
sudo apt-get install package
 
sudo apt-get Install package--Reinstall reinstall packages
 
sudo apt-get-f install fix "-F =--fix-missing"
 
sudo apt-get Remove Package
 
sudo apt-get Remove Package--purge delete packages, including deletion of configuration files, etc.
 
sudo apt-get update source
 
sudo apt-get upgrade update installed packages
 
sudo apt-get Dist-upgrade upgrade system
 
sudo apt-get dselect-upgrade using Dselect upgrade
 
Apt-cache depends package learn about using dependencies
 
Apt-cache Rdepends package is to see which packages are dependent on
 
sudo apt-get BUILD-DEP Package Installation-related compilation environment
 
Apt-get Source Package Downloads The source code for the bundle
 
sudo apt-get clean && sudo apt-get autoclean cleanup useless packet management bitscn_com
sudo apt-get check to see if there is a corrupted dependency

From Ubuntu Chinese Apt-cache Search #------(Package Search pack)
Apt-cache Show #------(package gets information about packages, such as description, size, version, etc.)
sudo apt-get Install #------(Package installer)
sudo apt-get Install #-----(Package-Reinstall reinstall packages)
sudo apt-get-f Install #-----(Force install? # "-F =--fix-missing" When it is a repair installation ...)
sudo apt-get Remove #-----(Package Delete pack)
sudo apt-get Remove--Purge #------(Package delete packages, including delete profiles, etc.)
sudo apt-get autoremove--purge #----(Package delete packages and their dependent packages + profiles etc (only valid for 6.10, highly recommended))
sudo apt-get update #------Updating source
sudo apt-get upgrade #------Update an installed package
sudo apt-get dist-upgrade #---------Upgrade System
sudo apt-get dselect-upgrade #------Upgrade with Dselect
Apt-cache depends #-------(package understands usage dependencies)
Apt-cache Rdepends #------(Package understands a specific dependency? #当是查看该包被哪些包依赖吧 ...)
sudo apt-get BUILD-DEP #------(Package Installation-related compilation environment)
Apt-get Source #------(Package downloads the source of the bundle)
sudo apt-get clean && sudo apt-get AutoClean #--------Cleanup the archive of downloaded files && clean up outdated packages only
sudo apt-get check #-------checks for corrupted dependencies


Apt-get Install
Download and all dependent packages, while installing or upgrading the package. If a package is set to hold (stop flag, it will be put aside (ie will not be upgraded). See below for more hold details.

Apt-get Remove [--purge]
Remove and any other parcels that depend on the package.
--purge indicates that the package should be completely cleared (purged), see dpkg-p for more information.

Apt-get Update
Upgrade the package list from the Debian image, if you want to install any software on the day, run at least once a day, and each time you modify the
After/etc/apt/sources.list, it must be executed.

Apt-get upgrade [-u]
Upgrade so the package that has been installed is the latest available version. New or removed old packages are not installed. If a package changes the dependency relationship and needs to install a new package, then it will not be upgraded, but is marked as hold. Apt-get Update does not upgrade the package marked as hold (this is the meaning of hold). See below how to manually set the package to hold. I recommend using the '-u ' option at the same time because you can see which packages will be upgraded.

Apt-get Dist-upgrade [-u]
Similar to Apt-get upgrade, except that Dist-upgrade installs and removes packages to satisfy dependent relationships. Therefore, it has a certain danger.

Apt-cache Search
Search for packages and descriptions that are met.

Apt-cache Show
The full description of the display.

Apt-cache showpkg
Show a lot of detail, and the relationship with other packages.

Dselect
Console-apt
Aptitude
Gnome-apt
Several graphical front ends of APT (some of which must be installed before use). Here Dselect is undoubtedly the most powerful, is also the oldest, the most difficult to control.

Common Dpkg Usage
Dpkg-i
Install a Debian package file, such as a file you have manually downloaded.

Dpkg-c
The listed content.

Dpkg-i
Extract the package information from it.

Dpkg-r
Remove a package that has already been installed.

Dpkg-p
Completely clears an installed package. Unlike remove, remove just deletes the data and executable files, and purge also removes all the configuration files.

Dpkg-l
Lists all installed file listings. Also see Dpkg-c to check the contents of a. deb file.

Dpkg-s
Displays information about the packages that have been installed. Also see Apt-cache displays the package information in the Debian archive, as well as dpkg-i to display the package information extracted from a. deb file.

Dpkg-reconfigure
Reconfigure an already installed package if it is using debconf (debconf provides a unified configuration interface for package installation). You can re-formulate debconf it itself, as you want to change its front end or ask for priority. For example, to re-configure the debconf, use a dialog front end and simply run:

Dpkg-reconfigure--frontend=dialog debconf (if you choose the wrong installation, you can change it back yo:)

echo "Hold" | Dpkg--set-selections
Set the status to Hlod (command line mode)

Dpkg--get-selections ""
Current state of the FETCH (command line mode)

Wildcard characters are supported, such as:
debian:~# dpkg--get-selections *wine*
Libwine hold
Libwine-alsa hold
Libwine-arts hold
Libwine-dev hold
Libwine-nas hold
Libwine-print hold
Libwine-twain hold
Wine hold
Wine+ hold
Wine-doc hold
Wine-utils hold

For example:
Everyone is now using gaim-0.58 + Qq-plugin, in order to prevent Gaim to be upgraded, we can use the following methods:

Method One:
debian:~# echo "Gaim hold" | Dpkg--set-selections
Then use the following command to check:
debian:~# dpkg--get-selections "Gaim"
Gaim hold
Now that the status flag is hold, it cannot be upgraded.

What if we want to recover?
debian:~# echo "Gaim Install" | Dpkg--set-selections
debian:~# dpkg--get-selections "Gaim"
Gaim Install
The status flag is then reset to install and you can continue with the upgrade.

Comrades will ask, which of these status signs are written in which file?
In/var/lib/dpkg/status, you can also implement hold by modifying this file.

Sometimes you will find that some software status signs are purge, don't be surprised.
such as: aMSN has been installed in advance, and then to unload it.
Apt-get Remove--purge amsn
Then the status flag is changed from install to purge.

Method Two:
Manually build a preferences file under/etc/apt
Content:
Package:gaim
Pin:version 0.58*
Save

Dpkg-s
Look in the package database and tell you which package contains the file. (Note: Search for packages that have been installed beforehand)

Apt-get's position in the Debian project is irreplaceable, if there is a program that can represent Debian
, there is no doubt that the Apt-get,apt-get and Deb packages provide a powerful feature that RPM cannot provide.

In addition to the convenience of apt, Apt-get's great advantage is that it greatly reduces the occurrence of so-called dependency nightmare
Odds (Dependency hell), even if caught in the dependency Hell,apt-get also provides a good
Aid means to help you escape from the Morgul.

Usually, apt-get are haunted by compressed packets on the Internet, downloaded or installed from the Web. The world has super
Over 200 official Debian images, as well as a wide range of unofficial packages to provide websites. You are using the D-based
Unlike the release version of Ebian, the repositories you use may need to be manually selected or set up automatically. You
Get a complete list of images from the official Debian website. And many unofficial websites offer a variety of special-purpose
Unofficial software packages, of course, there are more risks in using unofficial packages.

Packages are prepared for a basic Debian release (from unstable to stable), and are zoned
in different categories (e.g. main contrib nonfree), this is based on the Debian Free software program
Divided (that is, often said DFSG), because the United States restricts the export of encryption software, there is a non-us category.

Apt-get gets the settings written in the configuration file/etc/apt/sources.list that the package depends on
Is
                                                                      

Deb [Server-type] [address] [directories] [areas]


Examples in this article:



Deb [Url]http://mirror.peer1.net/debian[/url] main contrib Non-free


Examples of my time at school



Deb [Url]http://debian.ustc.edu.cn/debian/[/url] testing main contrib Non-free

If you use DEB-SRC instead of Deb, that means the source code package. HTTP and F are usually used
Tp method to get the file, but also can use local files, more rare also rsh and SSH, but all can be
Of Using NETSELECT-APT can be used to determine which mirror is faster. After you modify the image information, you should make
Update the package information with the Apt-get Update command

You can read about packages from the Debian website, and on the other hand you can use DPKG-L to see which
Some of the packages have been installed. Very large programs, such as GNOME, usually have an empty package, just by
Dependencies to install all other appropriate software, which can also be installed individually.

Use
Apt-get Install [Package-name]
You can install the package, there is no need for the version number, Apt-get will automatically select the latest. If the latest
has been installed, then it will not be installed. If you want to install an older version, you can select the version
This, for example


Apt-get Install gimp=2.2


You can also choose a specific release version



Apt-get install-t Unstable gimp



For installation source code, use source instead of install, if you need to compile, use the-B option
, the package will be downloaded to the current directory. (Aptitude Note: Only root can install, but
Anyone can source. )

Before execution, Apt-get will list how many packages are to be installed, upgraded, and if the software to be installed does not
Just the package you pointed out, then it will ask if you continue. You can use-s to see the results of the run
(Note: Do not know how this is simulated, did not try)

During the Apt-get installation, the status of the installation is displayed, and sometimes apt-get is called according to the requirements of the package
Debconf to let the user enter some configuration options. This configuration is generally a choice, usually by default
You can also use--yes to declare all of the default options, without asking questions. (Note: If you use cron to automatically update the system every day, this option is very useful, although always feel a little afraid of it.) )

Apt-get upgrade will not install the new package, only upgrade the original version of the package, to upgrade
Throughout the system, you may want to install a new package, which can be done through dist-upgrade, such as upgrading S
Table to testing, it is recommended to upgrade stable to unstable, first upgrade to testing to reduce the wind
Risk.

Use Apt-get clean to release the cache space occupied by the Apt-get or you can use AUTOCL
EAN command, which simply deletes files that are not likely to be downloaded again.

You can also use the Remove command to remove a package. (Note: If you want to even delete the configuration file
In addition, the--purge parameter needs to be used)

Sometimes there will be problems, you can use the following methods to solve:

      • -F Fix Dependency

      • -M ignores problematic packages (this is not a problem-solving attitude, OH)

      • -ignore-hold ignore the problematic hold

    • -S report Package Status
Of course, if your skills and patience are not enough, be careful to use the system, normal use will not normally
Cause a lot of problems to be solved:)

Over the years, Apt-get has a lot of front end, in addition to the commercial version, the other can be apt-get
To install. Text interface, aptitude is not bad, browsing software package is more convenient. For the graphical interface synaptic is a good choice, compared to the original apt, and kpachage is not so much like apt.

Most desktop Linux versions have a tendency to abandon the command line, but Apt-get is a command
The best exception is the line. Its existence is the reason why Debian-based systems are so big on the line. And
Apt-get has even been ported to the RPM system.

Apt-get command in Ubuntu Linux system

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.