Free cookie consent management tool by TermsFeed Policy Generator

/dev/blog/ID10T

Using netcat as port listener

Linux Comments

Advertisement

Short but useful tip:

If you want to test if a port is open on Linux (e.g. all firewalls were opened) but you don’t have the listening application installed yet, you can use nc/netcat.

On the server side do:

# For TCP

nc -l -p $PORT_NUMBER
# For UDP

nc -l -u -p $PORT_NUMBER

On the client side you can now connect to the listening port:

# For TCP

nc host.tld $PORT_NUMBER
# For UDP

nc -u host.tld $PORT_NUMBER

This is basically a telnet chat, so you can send strings which should then be received on the other side. If you want even more good uses for netcat, I recommend this blog post.

Advertisement

comments powered by isso

Advertisement