The difference and connection between aptitude and Apt-get in Ubuntu (Debian)

Source: Internet
Author: User

Recently using Puppet to quickly deploy OpenStack, see some unseen tools, such as aptitude, that have a strong apt-get on Ubuntu why use this. This article transferred from: http://hi.baidu.com/52safe/blog/item/c17891ff02201653d6887d96.html

At first the Gnu/linux system was only. tar.gz. Users must compile each program they want to use. After the advent of Debian, it was thought necessary to add a mechanism to the system to manage the packages installed on the computer. People call this system a dpkg. The first name of the ' package ' appeared on Gnu/linux. Soon after, the Red Hat also began to set up its own package management system ' rpm '.

The creators of Gnu/linux soon fell into a new dilemma. They want to install packages in a fast, functional, and efficient way. These packages can automatically handle dependencies between each other and maintain their profiles during the upgrade process. Debian has once again played a pioneering role. She pioneered the APT (Advanced packaging Tool). This tool was later transplanted into the Red Hat system for the management of RPM packages by Conectiva. We can see her in some other distributions as well.

"At the same time, APT is a complete and advanced package management program that allows you to easily and accurately find the packages you want, and the installation or uninstallation is simple. It also allows you to update all of your software to the latest state, and can also be used to upgrade Ubuntu. ”

"Apt is a software that needs to be manipulated with commands, but there are also a lot of graphics software, such as synaptic, kynaptic and Adept. ”

Command

All the commands that will be described below need to be sudo! When using, replace "PackageName" and "string" with the program you want to install or find.

* Apt-get update--Run the command after modifying/etc/apt/sources.list or/etc/apt/preferences. In addition, you need to run this command regularly to ensure that your package list is up-to-date.

* Apt-get Install packagename--installs a new package (see aptitude below)

* Apt-get Remove packagename--Uninstall an installed package (keep config file)

* Apt-get–purge Remove packagename--Uninstall an installed package (delete config file)

* Dpkg–force-all–purge PackageName Some software is difficult to uninstall, but also to prevent the application of other software, you can use this, but a bit risky.

* Apt-get AutoClean Apt will back up the installed or unloaded software on the hard drive, so if you need space, you can let this command to delete the software you have deleted

* Apt-get Clean This command will also remove the backup of the installed software, but this will not affect the use of the software.

* Apt-get upgrade--Update all installed packages

* Apt-get dist-upgrade--Upgrade the system to a new version

* Apt-cache Search string--searching for strings in the package list

* Dpkg-l package-name-pattern--Lists all packages that match the pattern. If you do not know the full name of the package, you can use "*package-name-pattern*".

* aptitude--Detailed view of installed or available packages. Similar to Apt-get, aptitude can be called by command-line mode, but only for certain commands-the most common are installation and uninstallation commands. Since aptitude has more information than apt-get, it can be said to be more suitable for installation and uninstallation.

* Apt-cache showpkg pkgs--displays package information.

* Apt-cache dumpavail--Print the list of available packages.

* Apt-cache Show pkgs--shows the package record, similar to Dpkg–print-avail.

* Apt-cache pkgnames--The name of all packages in the print package list.

* Dpkg-s file--This file belongs to which installed package.

* Dpkg-l package--Lists all files in the package.

* Apt-file Search filename--Find packages that contain specific files (not necessarily installed), which contain the specified string in the file name. The Apt-file is a standalone package. You must first install it using the Apt-get install and then run Apt-file update. If apt-file search filename outputs too much content, you can try using Apt-file search FileName | Grep-w filename (shows only those filenames where the specified string appears as the complete word) or a similar method, for example: Apt-file search FileName | Grep/bin/(it is helpful to show only files that are located in folders such as/bin or/usr/bin, if you are looking for a specific executable file).

* Apt-get autoclean--Run this command periodically to clear the. deb file for the packages that have been uninstalled. In this way, you can free up a lot of disk space. If your needs are urgent, you can use apt-get clean to free up more space. This command will remove the. deb file that has the software package installed. In most cases you will not be able to use these. debs files, so if you are overwhelmed by the lack of disk space, this approach may be worth a try.

Typical applications

  • I'm a racing enthusiast and want to play a racing game. What kind of racing games are there to choose from?
  • Apt-cache Search Racing Game
  • Came out a whole lot of results. See if there's any more information about TORCS this game.
  • Apt-cache Show Torcs
  • It looks good. Has this game been installed? What's the latest version? What kind of software does it belong to, universe or main?
  • Apt-cache Policy Torcs
  • Well, now I'm going to install it!
  • Apt-get Install Torcs
  • What commands should I invoke in the console to run this game? In this case, it's OK to use Torcs directly, but it's not always that simple. We can determine the binary file name by finding which files are installed in the "/usr/bin" folder. For game software, these binaries will be installed under "/usr/games". The appropriate folder for the System administration tool is "/usr/sbin".
  • Dpkg-l torcs|grep/usr/games/
  • The previous section of this command shows all files installed by the package "Torcs" (Try it yourself). Through the second part of the command, we tell the system to show only those rows that contain "/usr/games" in the output of the previous section.
  • This game is very cool oh. Maybe there are other tracks to play with?
  • Apt-cache Search Torcs
  • My disk space is not enough. I have to clear the cache space for apt.
  • Apt-get Clean
  • Oh no, mom asked me to erase all the games on the machine. But I want to keep the configuration file so that I can just reload it and keep playing.
  • Apt-get Remove Torcs
  • If I want to delete a piece of configuration file:
  • Apt-get Remove–purge Torcs
  • Additional Packages
  • The Deborphan and Debfoster tools can find out which packages are not being used on the system.
  • Improve productivity in command-line mode

You can increase the speed at which these commands are entered by defining aliases (alias). For example, you can add the following content to your *~/.bashrc* file

Alias acs= ' Apt-cache search '
Alias agu= ' sudo apt-get update '
Alias agg= ' sudo apt-get upgrade '
Alias agd= ' sudo apt-get dist-upgrade '
Alias agi= ' sudo apt-get install '
Alias agr= ' sudo apt-get remove '

Or use the aptitude command described earlier, such as "Alias agi= ' sudo aptitude install '".

———————————————————————————————-

Like Apt-get, Aptitude is the most powerful package management tool in Debian and its derivative systems. Unlike Apt-get, aptitude is better at dealing with dependency issues. For example, when aptitude deletes a package, it also deletes the packages it depends on. This way, the system will not be left with useless packets, the whole system is cleaner. The following is a summary of some of the common aptitude commands, for reference only.
Command function
Aptitude update updates the list of available packages
Aptitude Upgrade Upgrade Available packages
Aptitude Dist-upgrade Upgrade the system to a new release
Aptitude Install Pkgname installation package
Aptitude Remove Pkgname Delete Package
Aptitude Purge Pkgname Delete package and its configuration file
Aptitude search String Searching package
Aptitude show Pkgname shows the details of the package
Aptitude Clean Delete the downloaded package file
Aptitude AutoClean Delete Expired package files only

Of course, you can also use aptitude in text interface mode.

Some problems apt-get can not solve, must use aptitude solution, some problems, with aptitude can not solve, must use Apt-get

    • Aptitude better Solution: Install, remove, reinstall (Apt-get without this function), show (Apt-get without this feature), search (Apt-get without this feature), hold (Apt-get no this feature) , Unhold (Apt-get without this function),
    • Apt-get Better solution: Source (aptitude without this function), BUILD-DEP (low version of aptitude without BUILD-DEP function)
    • Apt-get is no different from aptitude: Update, upgrade (Apt-get upgrade=aptitude Safe-upgrade, Apt-get dist-upgrade=aptitude Full-upgrgade)


--- I'm a low-key, unobtrusive, concise, split-line that won't be discovered by the enemy ---


     this article Powered by effort cowhide sugar

     Novice on the road, not exactly the place, kindly pointed out, thank you

Reprint please indicate the source " a piece of hard-working cowhide sugar ":http://www.cnblogs.com/yuxc/

The difference and connection between aptitude and Apt-get in Ubuntu (Debian)

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.