Netcat is a versatile networking utility which can be used for reading from and writing to TCP and UDP connections on arbitrary ports (as with other utilities used on Linux, ports below 1024 require root/sudo privileges). By default netcat uses TCP connections, but UDP can be specified with the
-u flag. Netcat can be used as both a server and a client. When used as a server the
-l flag is used to listen for a connection. Similar to the cat command, netcat can receive information from stdin and write to stdout making it great for workflows involving pipes and redirects. The nc command is typically used to evoke netcat for ease of use.
This is a companion discussion topic for the original entry at https://linuxconfig.org/tips-trick-with-netcat-command-on-linux