Slackware

Creating shortcut for finding installed Slackware packages

Lazy I am so I created a shortcut for checking if a package is installed in Slackware. Packages are listed on /var/log/packages so basically a basic ls | grep combo is needed to see if a package is already installed. Below is my little script and I name it as pkgfind.

#!/bin/sh

if [ "$1" == "" ]; then
    echo "Usage: pkgfind <package-name>" 
    exit 1
fi

ls /var/log/packages | grep "$1"

This is located at my bin directory at ~/bin/pkgfind. Add an execute bit to it and be sure the path is added to user’s path so that the current user can use it anywhere. Or if you wanted a global script, put it in /usr/bin/pkgfind.

Example:

lysender@darkstar:~$ pkgfind opencv
opencv-2.3.1a-i486-2_SBo
lysender@darkstar:~$ pkgfind lolcat
lysender@darkstar:~$ pkgfind ffmpeg
ffmpeg-0.10.2-i686_custom-1_SBo
lysender@darkstar:~$ 

I synced it u with SpiderOak so that I could also use it in the office.

Leave a reply

Your email address will not be published. Required fields are marked *