Small tips to hopefully make your life easier. Anything in a code block should be run on the command line.
Is package 'x' installed?
$ dpkg -l | grep gnome-terminal ii gnome-terminal 3.6.2-0ubuntu1 amd64 GNOME terminal emulator application ii gnome-terminal-data 3.6.2-0ubuntu1 all Data files for the GNOME terminal emulator
As we can see from the above output, the package is installed.
$ dpkg -l | grep foobarbaz $
No output in this case means that grep could not find package or description that matched your search query.