Breaking News
Home / Sys Admin / Unix / How to check if a port is open using Terminal in Unix?

How to check if a port is open using Terminal in Unix?

There a couple of ways to find out.

1) Using telnet to find if port is open on a remote/localhost using the command as:

telnet hostname portnumber

If a port is open then there would be some output on the terminal other wise it would say connection refused or something similar message.

mvohra@livrona:~$ telnet developerfeed.com 2201
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.

2) Using netstat to find out if the port is open.

netstat -na | grep portnumber

mvohra@livrona:~$ netstat -na | grep 2201
tcp        0      0 0.0.0.0:2201            0.0.0.0:*               LISTEN    
mvohra@livrona:~$

If a process is listening on a port it would show up in the grep with the word LISTEN.<!>

[pb_builder]

Check Also

How to list disks information in Linux?

In order to check the disk in the system we can use the List Hardware …

Leave a Reply