Apr 13, 2013

The 5 sample of apt-cache Ubuntu Command for Package Management

APT (usually written using the lowercase)  is acronym of Advanced Package Tool. It is a common tool which used to manage the software using the command line in terminal. Basically, apt-cache and apt-get command are available by default. We can manually add apt-fast. Our previous brief tutorial explained you on how to replace apt-get with apt-fast. The apt-get and apt-cache command basically is used for Debian based Linux, such as Ubuntu, Linux Mint and other variant which is developed based on Debian.

What is apt-get? Apt-get get is actually a command line especially developed to support packages management on  Debian and its variant. It can be implemented for package installation, removing installed package, updating the newest available package and upgrading the same one. It can be used as well for upgrading the operating system version. And What is apt-cache? Apt-cache (written with lower cases) is actually a command line which is used to obtain the information related to the package installed on the system or available on the repository.

The list and sample apt-cache command Line 

a. How do I see the package list on Ubuntu/Debian/Linux Mint?
To see list of available packages you can type the command and see the sample of it below:

apt-cache pkgnames


Result:

diatheke
cyrus-admin-2.2
libsmpeg0
bookletimposer
libexcalibur-logkit-java-doc
libdbus-c++-dev
.......................


b. How to check package information on Debian/Ubuntu/Linux Mint?
Actually you can check the information for the specific package including release version, size, installed size, etc. For this tutorial I'll use "calibre" as the sample. Run the command below:

apt-cache show calibre

Result:

apt-cache show calibre
Package: calibre
Priority: extra
Section: text
Installed-Size: 36699
Architecture: all
Version: 0.9.25+dfsg-0~ppa1
Recommends: python-dnspython
.............................................

c. How to check package dependencies on Ubuntu, Linux Mint and Debian?
You can use "showpkg" to get information about the dependencies of the specific package. We use calibre as  the sample. See the command below:

apt-cache showpkg calibre

Result:

Package: calibre
Versions:
0.9.25+dfsg-0~ppa1 (/var/lib/apt/lists/ppa.launchpad.net_n-muench_calibre_ubuntu_dists_quantal_main_binary-i386_Packages)
......................................


d. How to know the description of the package ?
To know the description of packages we can use the "apt-cache search" followed by the name of package. For the example, see the command below:

apt-cache search calibre


Result:

calibre - e-book converter and library management
calibre-bin - e-book converter and library management


e. How to check the statistic of cache?
The command apt-cache stats is used to explore overall information related to the cache. It reveals all information available in the cache.


apt-cache stats



Result:

Total package names: 52314 (1,046 k)
Total package structures: 52314 (2,511 k)
Normal packages: 39861
Pure virtual packages: 606
Single virtual packages: 3827
Mixed virtual packages: 1053
Missing: 6967
Total distinct versions: 43512 (2,785 k)
Total distinct descriptions: 81415 (1,954 k)


Those are five apt-cache command which can be used for package management.

Enjoy to use your terminal.