Faster rpmfind command

How do you check for a specific rpm if it is installed? You can do it this way:

rpm -q <package name>

This way you need to enter full name So you can do this:

rpm -qa|grep -i <part of package name>

But it's slow

Then why don't you make scripts to save rpm list. This will speed up the query:

1. Script for saving rpm list for faster reference (name it rpmlist):

#!/bin/bash
rpm -qa >~/rpmlist

2. Script for searching in rpmlist(name it rpmfind):

#!/bin/bash
grep -i $1 ~/rpmlist