Is my port open?

December 1, 2020
PostgreSQL Administration

As a consultant, I frequently need to install Postgres for customers. Of course I send them a list of prerequisites beforehand but, I don’t know why, there’s always a problem with one of them and, most often, the problem concerns port opening.

Tools? Who needs tools?

Sysadmins will recommend you to use either nmap or netcat or netstat and you might need to combine those tools (which syntax you will keep forgetting) with grep to find if your port is listed.

Then you will have to remember if the syntax you chose was to display open or close ports…

That’s a little too sophisticated for me. I just want to know if a specific port is open or close!

Linux can help

So, you need to know that Linux works with files. It does not feel like breaking news here, but it means that hosts and ports availability are also files. We can use that to our benefit :

(echo >/dev/tcp/<host>/<port>) &>/dev/null && echo "open" || echo "close"

This command will simply answer “open” or “close” to tell you if the port is open or close. Simple, isn’t it?

PGSQL Phriday #010: Log analysis

July 7, 2023
PGSQL Phriday PostgreSQL

Triggers: reading other opinions

April 21, 2023
PGSQL Phriday PostgreSQL

Triggers and me

April 7, 2023
PGSQL Phriday PostgreSQL