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?

How to do proper backups

November 4, 2022
PostgreSQL PGSQL Phriday Administration

2 it depends and one absolutely always do this!

October 7, 2022
PostgreSQL psql PGSQL Phriday

PGConfEU: My ideal schedule

October 6, 2022
PostgreSQL event