Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howtos:slackware_admin:querying_installed_packages [2012/09/25 04:17 (UTC)] (current)
mfillpot moved from the general howtos namespace
Line 1: Line 1:
 +<!-- Add your text below. We strongly advise to start with a Headline (see button bar above). -->
 +===== Querying Installed Packages =====
  
 +Sometimes you might want to check whether a particular package is installed or which version of a package is installed on your system. If the package is part of the Slackware installation you could use the ''​slackpkg''​ tool:
 +
 +<​code>​
 +# slackpkg info emacs
 +
 +PACKAGE NAME:  emacs-24.1-x86_64-6.txz
 +PACKAGE LOCATION: ​ ./​slackware64/​e
 +PACKAGE SIZE (compressed): ​ 36704 K
 +PACKAGE SIZE (uncompressed): ​ 110720 K
 +PACKAGE DESCRIPTION:​
 +emacs: emacs (GNU Emacs)
 +emacs:
 +emacs: Emacs is the extensible, customizable,​ self-documenting real-time
 +emacs: display editor. If this seems to be a bit of a mouthful, an
 +emacs: easier explanation is that Emacs is a text editor and more. At
 +emacs: its core is an interpreter for Emacs Lisp, a dialect of the Lisp
 +emacs: programming language with extensions to support text editing.
 +emacs: This version supports X.
 +emacs:
 +emacs: http://​www.gnu.org/​software/​emacs/​
 +emacs:</​code>​
 +
 +This works fine for Slackware core packages. Some of us, however, install additional programs from a number of sources (eg. [[http://​www.slackbuilds.org|SlackBuilds]]),​ which are not taken into account by ''​slackpkg''​. Another method which includes all correctly installed* packages is as follows:
 +
 +<​code>​ls /​var/​log/​packages | grep i3
 +i3-4.2-x86_64-1_SBo
 +i3status-2.5.1-x86_64-1_SBo</​code>​
 +
 +First we list the contents of the ''/​var/​log/​packages''​ directory which includes the names of all the currently installed packages. Then we pipe it to grep to narrow down the results and only display packages matching our pattern.
 +
 +Another example showing all packages installed from Slackbuilds:​
 +
 +<​code>​ls /​var/​log/​packages | grep SBo</​code>​
 +
 +If you don't want to type it each time, you could create a very short script and add it to your path:
 +
 +<file bash pkg.sh>
 +#!/bin/sh
 +packages_dir=/​var/​log/​packages/​
 +
 +if [ "​$#"​ -eq 1 ]; then
 +        ls $packages_dir | grep $1
 +else
 +        echo "​Please,​ provide one argument"​
 +fi</​file>​
 +
 +<​code>​$ pkg.sh cairo
 +cairo-1.10.2-x86_64-2
 +cairomm-1.9.8-x86_64-1_SBo
 +pycairo-1.8.10-x86_64-2</​code>​
 +
 +
 +<​note>​*Please note that if you directly run binary installers (eg. ''​VirtualBox''​),​ a program will not have an entry in ''/​var/​log/​packages/''​.</​note>​
 +
 +===== Sources =====
 +  * Originally written by [[wiki:​user:​sycamorex]]
 +
 +<!-- Please do not add anything below, except additional tags.-->
 +<!-- However we request that you remove the tag-word "​template"​ below. Otherwise your page will not show up in the Table of Contents -->
 +
 +<!-- Do not remove this line and the tag definition below. Thanks! slackdocs@-->​
 +{{tag>​howtos software package_management package_tracking author_sycamorex}}

In Other Languages
QR Code
QR Code howtos:slackware_admin:querying_installed_packages (generated for current page)