Here is a quick tutorial on sending UDP and TCP data on Linux terminal using /dev/udp and /dev/tcp.

Base Command

$ echo "YOUR_MESSAGE" > /dev/{TRANSPORT_PROTOCOL}/{DESTINATION_IP}/{DESTINATION_PORT}

UDP

$ echo "This is my UDP message" > /dev/udp/127.0.0.1/30000

TCP

$ echo "This is my TCP message" > /dev/tcp/127.0.0.1/30100

✅ Tested OS's : RHEL 7+, CentOS 7+, Ubuntu 18.04+, Debian 8+
✅ Tested Gear : Cloud (AWS EC2), On-Prem (Bare Metal)

👉 Any questions? Please comment below.


Leave a comment