Apt-get Summary

Source: Internet
Author: User

Zhuanzi:apt-get Summary 1.apt-get Install <package_name>

Install a new package.

2.apt-get BUILD-DEP <package_name>

Search the repositories and install the build dependcies for <package_name>.

BUILD-DEP causes Apt-get to Install/remove packages in an attempt to satisfy the build dependencies for a source package.

3.aptitude Install <package_name>

Aptitude is a [http://en.wikipedia.org/wiki/Ncurses ncurses] Viewer of packages installed or available. Aptitude can used from the command line in a similar-apt-get. See Mans Aptitude for more information.

4.apt-get Install <package1_name> <package2_name> <package3_name>

APT and aptitude would accept multiple package names as a space delimited list.

5.USE the-s flag to simulate an action. " sudo apt-get-s install <package_name> "'ll simulate installing the package showing you what packages'll be Insta Lled and configured.

6.apt-get Update

Run This command after changing /etc/apt/sources.list or /etc/apt/preferences . For information regarding /etc/apt/preferences, see Pinninghowto. Run This command periodically the sure your source list is up-to-date. This is the equivalent of ' Reload ' in Synaptic or ' Fetch updates ' in Adept.

7.apt-get Upgrade

This command upgrades all installed packages. This is the equivalent of ' Mark all upgrades ' in Synaptic.

8.apt-get Dist-upgrade

The same as the above, except add the "Smart Upgrade" checkbox. It tells APT to use "smart" conflict resolution system, and it'll attempt to upgrade the most important packages at the Expense of less important ones if necessary.
"Apt-get Dist-upgrade" does not perform distribution upgrade. See [http://www.ubuntu.com/getubuntu/upgrading Upgrading] for more information.

9.apt-get Check

This command is a diagnostic tool. It does an update of the package lists and checks for broken dependencies.

10.apt-get-f Install

This command does the same thing as Edit->fix broken Packages in Synaptic. Do the If you get complaints about packages with "unmet dependences".

11.apt-get AutoClean

This command removes the. deb files for packages that is no longer installed on your system. Depending on your installation habits, removing these files from /var/cache/apt/archives may regain a significant Amount of diskspace.

12.apt-get Clean

The same as above, except it removes all packages from the package cache. This is desirable if you have a slow internet connection, since it'll cause you to redownload any packages you n Eed to install a program.

The package cache was in /var/cache/apt/archives . The command

Du-sh/var/cache/apt/archives

Would tell you how much space cached packages is consuming.

13.dpkg-reconfigure <package_name>

Reconfigure the named package. With the many packages, you'll be prompted with the some configuration questions you are not having known were there.

For example:

Dpkg-reconfigure Fontconfig-config

Would present you with a "wizard" on configuring fonts in Ubuntu.

14.echo "<package_name> hold" | Dpkg--set-selections

This command places the desired. This is the same as Synaptic ' s package->lock Version.

This command may has the unintended side effect of preventing upgrades to packages that depend on updated versions of the Pinned package. Apt-get Dist-upgrade would override this, but would warn you first. If you want the command with sudo, you need the use of echo "<package_name> hold" | sudo dpkg--set-selectio NS not sudo echo ' <package_name> hold ' | dpkg--set-selections.

15.echo "<package_name> Install" | Dpkg--set-selections

This command removes the ' hold ' or ' locked package ' state set by the above command. The note above about sudo usage applies to this command.


16.apt-get Remove <package_name>
This command removes the installed package, leaving configuration files intact.

17.apt-get Purge <package_name>

This command completely removes a and the associated configuration files. Configuration files residing in ~ is not usually affected by the this command.

+ operator
If you want to remove Package1 and install Package2 in one step:
Apt-get Purge Remove <package1> <package2>+

18.apt-get Autoremove
This command removes packages, were installed by other packages and is no longer needed.

Apt-get Autoremove <package_name>

This command removes the installed package and dependencies.

19.apt-cache Search <search_term>

This command would find packages that include <search_term>.

20.dpkg-l *<search_term>*

This would find packages whose names contain <search_term>. Similar to Apt-cache search, but also shows whether a package are installed on your system by marking it with II (installed) and un (not installed).

21.apt-cache Show <package_name>

This command shows the description for package <package_name> and other relevant information including version, size, dependencies and conflicts.

22.dpkg--print-avail <package_name>

This command was similar to "Apt-cache show".

23.dpkg-l <package_name>

This command would list files in the package <package_name>.

24.dpkg-c Foo.deb

This command lists files in the "Foo.deb". Note that foo.deb is a pathname. Use the This command on the. Deb packages so you have manually downloaded.

25.dlocate <package_name>

This command determines which installed package owns <package_name>. It shows files from installed packages that match <package_name>, with the name of the package they came from. Consider this to is a "reverse lookup" utility.

In order to use this command, the package dlocate must is installed on your system.

26.dpkg-s <package_name>

This command does the same as dlocateand does not require the installation for any additional packages. It is slower than dlocate but have the advantage of being installed by default on all Debian and Ubuntu systems.

27.apt-file Search <package_name>

This command acts like Dlocate and dpkg-s, but searches all available packages. It answers the question, "What's package provides this file?".
Apt-file needs to is updated regularly like Apt-get. Use the command:
Apt-file Update

In order to use this command, the package Apt-file must is installed on your system.

28.apt-cache Pkgnames

This command provides a listing of every the system

A general note on Searching:if searching for a generates a list that's too long, you can filter your results by piping t Hem through the command grep. Examples:

Apt-cache Search FileName | grep-w filename

Would show only the files that contain filename as a whole word

Would list files located in the Directory/usr/bin, useful if you ' re looking for a particular executable.

For more information in Apt-get, Apt-cache and dpkg consult their manual pages by using the Man command. These manuals would provide a wider scope of information in addition to all of the options so can use with each progr Am.

Mans Apt-get

Typical usage Example

1.I want to feel the wind in my hair, I want the adrenaline of speed. So lets install a racing game. But what racing games is available?

Apt-cache Search Racing Game

2.It gives me a lot of answers. I see a game named "Torcs". Lets get some more information on the this game.

Apt-cache Show Torcs

3.Hmmm ... It seems interesting. Already installed on my computer? And what is the available version? Is it from Universe or main?

Apt-cache Policy Torcs

4.Ok, so now, let's install it!

Apt-get Install Torcs

5.What is the command I must type in the console to launch this game? In this example, it's straightforward ("Torcs"), but that's not always the case. One-to-finding the name of the binary is-to-look at the "the" and "the package have installed in"/usr/bin ". For games, the binary would be is in "/usr/games". For administrative programs, it's in "/usr/sbin".

Dpkg-l Torcs | grep/usr/games/

The first part of the command display all files installed by the package "Torcs" (Try it). With the second part, we ask to only display lines containing "/usr/games/".

6.Hmmm, that's game is cool. Maybe there is some extra tracks?

Apt-cache Search Torcs

7.But I ' m running out of space. I'll delete the apt cache!

Apt-get Clean

8.Oh No, my mother asked me to remove all games from this computer. But I want to keep the configuration files so I can simply re-install it later.

Apt-get Remove Torcs

9.If I want to also remove config files:

Apt-get purge Torcs

Setting up Apt-get to use a http-proxy

These is three methods of using Apt-get with a http-proxy.   

1.Temporary Proxy Session

This is a temporary method so can manually use the each time you want the use Apt-get through a http- Proxy. This method was useful if you have want to temporarily use a http-proxy. Enter The terminal prior to using Apt-get (substitute your details for yourproxyaddress A nd proxyport).   

Export Http_proxy=http://yourproxyaddress:proxyport

2.APT configuration File method

This method uses the Apt.conf file which are found in your /etc/apt/ directory. This method was useful if you have want Apt-get (and not other applications) to use a http-proxy permanently.

On some installations there'll be is no apt-conf file set up. This procedure would either edit an existing apt-conf file or create a new apt-conf file.

Gksudo geidt/etc/apt/apt.conf

Add the Your /etc/apt/apt.conf file (substitute your details for yourproxyaddress and ProxyPort).

Acquire::http::P Roxy "Http://yourproxyaddress:proxyport";

Save the apt.conf file.

3.BASH RC Method

This method adds a, lines to your. bashrc file in your $HOME directory. This method was useful if you would like Apt-get and other applications for instance wget, to use a http-proxy. gedit ~/.BASHRC

ADD These lines to the bottom of your ~/.bashrc file (substitute your details for yourproxyaddress and ProxyPort)

Http_proxy=http://yourproxyaddress:proxyport
Export Http_proxy

Save the file. Close your terminal window and then open another terminal window or source the ~/.bashrc file:

SOURCE ~/.BASHRC

Test your proxy with sudo apt-get update and whatever networking tool for you desire. You can use the firestarter or conky to see active connections.

If you do a mistake and go back to edit the file again, you can close the terminal and reopen it or you can source ~/.BASHRC as shown above.

SOURCE ~/.BASHRC

How to login a proxy user

If you need to login to the Proxy server This can is achieved in most cases by using the following layout in specifying th E proxy address in http-proxy. (Substitute your details for username, password, yourproxyaddress and ProxyPort)

Http_proxy=http://username:[email protected]:p Roxyport

Apt-get Summary

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.