Quantcast
Channel: Developer Feed - Unix
Viewing all articles
Browse latest Browse all 10

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

$
0
0

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.

read more


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images