To check if an application is installed using apt on a Debian-based system like Ubuntu, you can use the following methods:
1. Using apt list --installed and grep:
This method lists all installed packages and then filters for your specific application.
Code

apt list --installed | grep <package-name>

Replace <package-name> with the exact name of the application's package. If the package is installed, you will see output containing information about it, including [installed]. If not, there will be no output.
2. Using apt -qq list:
This command specifically checks the status of a package and indicates if it's installed. The -qq option provides quiet output, suppressing extra messages.
Code

apt -qq list <package-name>

If the package is installed, the output will include [installed] at the end of the line. For example:
Code

awscli/stable,now 1.4.2-1 all [installed]

If it's not installed, the output will simply show the available version without [installed].
3. Using dpkg -l and grep:
While apt is a higher-level tool, dpkg is the underlying package manager. You can use it to list all installed packages and then filter with grep.
Code

dpkg -l | grep <package-name>

If the package is installed, you will see a line starting with ii (indicating "installed") followed by package information.
4. Using apt show:
This command displays detailed information about a package, and if installed, it will often include a line like APT-Manual-Installed: yes or Installed: <version> in the output.
Code

apt show <package-name>

Choose the method that best suits your needs for checking the installation status of an application.