How to know if a package is installed (rpm and deb)

How do we know if a concrete package is already install on a Linux system? Let’s assume you’re managing both major package system, RPM and deb.

Rpm based systems
I suggest a fas t, simple and minimal command:
# rpm -q $package name
(For more information you just add a i, stands for information)

If a package is installed we’ll see a line with the package name:
[user@localhost}$ rpm -q vlc
vlc-3.0.11-1.fc32.x86_64
And if it nos installed we get a line informing about it:
[user@localhost}$ rpm -q nginx
package nginx is not installed

Deb – Apt systems
There many ways, but I suggest a fast, simple and minimal command such this:
# apt list --installed $package name

If a package is installed we’ll see a line with the text installed:
user@localhost:~ $ apt list --installed nginx
Listing... done
nginx/oldstable, now 1,10.3-1+deb9u3 all [installed]
And if it is not installed we didn’t see that line:
user@localhost:~ $ apt list --installed apache2
Listing... done