---

How to open a TCP/UDP socket in a bash shell

Suppose you want to open a TCP/UDP socket on a Linux server for various reasons. For example, you want to check if a specific address/port is reachable. Or you want to fetch a remote web page or invoke a restful API for testing. Or you want to connect to a remote IRC server, etc. However, what if the Linux server you are on is very restrictive? One of built-in features of bash shell is to open TCP/UDP sockets via /dev/tcp (and /dev/udp) device file.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis