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:
# 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:
This works fine for Slackware core packages. Some of us, however, install additional programs from a number of sources (eg. SlackBuilds), which are not taken into account by slackpkg
. Another method which includes all correctly installed* packages is as follows:
ls /var/log/packages | grep i3 i3-4.2-x86_64-1_SBo i3status-2.5.1-x86_64-1_SBo
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:
ls /var/log/packages | grep SBo
If you don't want to type it each time, you could create a very short script and add it to your path:
- 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
$ 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
Another way to find out the installed packages
- installed_pkgs_info
#!/bin/sh #Save this script as "installed_pkgs_info" probably in /usr/local/bin pkgdir="/var/lib/pkgtools/packages/" printf "\n\n\b\t Getting the information about installed pkgs...\n\n" cd $pkgdir for i in *;do slackpkg info $i | grep "PACKAGE NAME:"; sleep 1;done
And the output should look like this : root@Slackware_16:45:19_Tue Jun 16:~#installed_pkgs_info Getting the information about installed pkgs... PACKAGE NAME: ConsoleKit2-1.2.1-x86_64-4.txz PACKAGE NAME: Cython-0.29.20-x86_64-1.txz PACKAGE NAME: GConf-3.2.6-x86_64-4.txz PACKAGE NAME: LibRaw-0.18.12-x86_64-1.txz PACKAGE NAME: M2Crypto-0.35.2-x86_64-5.txz PACKAGE NAME: MPlayer-20200103-x86_64-2.txz PACKAGE NAME: MPlayer-20200103-x86_64-2_alsa.txz ..snipped output for brevity!
VirtualBox
), a program will not have an entry in /var/log/packages/
.