netcat — quick reference

Arbitrary TCP and UDP connections and listens

Scan for listening daemon, without sending data

BSD
> nc -z example.com 20-30
GNU
> nc -zv example.com 20-30

Client/Server

BSD
> nc -l 1234 # server
> nc example.com 1234                                       # client
> nc -l 1234 > out.txt                                      # server
> nc example.com 1234 < in.txt                              # client
GNU
> nc -lp 1234

BSD man page