I have ssh access to my Linux server and I want to check whether port 25 open or not.

I discussed with hosting service provide and they said port 25 is open.

I checked using PHP script for port 25 and it says it is open.

I want to know how to check using command on linux server like in Windows I can use telnet example.com 25

Any idea?

  • 1
    Does telnet example.com 25 not work for you?
    – dobey
    Nov 13, 2017 at 9:02
  • I was testing on linux server, I didn't got response after telnet, so I thought it is for only windows. Nov 13, 2017 at 12:05

1 Answer 1


You should check it from your home PC or another computer than your Linux server. you can use several tools like telnet, curl, netcat (nc) etc.


$ curl ip_or_domain:25


$ nc ip_or_domain 25

in any case if you got 220 hostname SMTP Mail Server this shows that the port is open.

  • When I am doing then getting error as "curl: (7) Couldn't connect to server" and nc mydomain.com 25 shows no output Nov 13, 2017 at 12:15
  • nc doesn't print out information to stdout but you could check its response like nc ip_or_domain 25 && echo $? if it is 0=> success, if not => failure
    – derHugo
    Nov 13, 2017 at 17:41
  • @shahab82 what is the output of curl ip_or_domain 25 -v? Nov 13, 2017 at 21:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.