How to Check the PostgreSQL Version on Linux?

PostgreSQL is the most powerful, robust, and object-relational database that can be used to extend some functions of the SQL database. PostgreSQL is a relational database and is widely used in the Linux system. Interestingly, PostgreSQL offers a GUI tool named pgAdmin4 to run the PostgreSQL queries. Using the latest version of PostgreSQL is recommended to get more effective support. You need to know how the PostgreSQL version can be checked on Linux. In this blog, the possible methods to check the installed version of PostgreSQL on Linux will be explained.  The content of this post is as follows:

Let’s start the guide!

Prerequisites: How to Install PostgreSQL?

PostgreSQL can be installed on Linux using the command-line interface, and the detailed installation method of PostgreSQL on Linux has been explained in an article whose link is attached.

Method 1: How to Display the PostgreSQL Version Using the Terminal on Linux?

The first method to check the PostgreSQL version on Linux is by running the below-mentioned command in the terminal:

$ psql --version
How to install Kali Linux in Window...

The version details of the PostgreSQL have been displayed.

Method 2: How to Display the PostgreSQL Version Using the SQL Shell on Linux?

Another approach to check the version of installed PostgreSQL is by using the SQL Shell. To do so, the following two simple steps are sued:

Step 1: Enter psql Shell

First, you need to enter the “psql” shell as a “postgres” user via the command provided below:

$ sudo -u postgres psql

Step 2: Check the PostgreSQL Server Version

After entering the SQL shell, use the command to display the installed PostgreSQL server’s version along with its build details:

SELECT version();

Another command to display the PostgreSQL server’s version details, run the command:

SHOW server_version;

The server version details of the PostgreSQL have been displayed.

That’s all from this post!


To check the PostgreSQL version using the terminal, run the command “ psql –version” and to check the version using the SQL shell, use the command “SELECT version();”. In this blog, two different methods of checking the PostgreSQL Version on Linux are explained.