Main Menu

Search

LINUX: "nc" Command To Test Listening On Specific Port To Check if Port Is Unused

Following is command to use.

nc -l <port number>

If the port is unused, you will see no output when running the command and you will not return to prompt unless you do Ctrl C. When the command is running, you can try to telnet from other machine to the machine where you have above nc command running on the port specified in nc command. You will get connected prompt.

If the port is not available and is used by another program following message is displayed when runnign nc command.

 # nc -l 22
Ncat: bind to :::22: Address already in use. QUITTING.

 


Products to which Article Applies

All Linux Operating System 

Search Keywords: Linux check checking port status state used unused available not netcat net cat utility program command commands validate validating

Article Author: Tarun Boyella

 

No comments:

Post a Comment