Netcat is a network service for reading and writing network connections using either TCP or UDP. It has the ability to create almost any kind of network connections and has many interesting capabilities. Hence, it is commonly termed as "the Swiss army knife of networking".
Here are a few examples of common Netcat commands:
Listen for incoming connections on port 8080: nc -l 8080
Connect to a remote host on port 80: nc example.com 80
Send a file "test.txt" to a remote host on port 1234: nc example.com 1234 < test.txt
Receive a file from a remote host on port 1234 and save it as "received.txt": nc -l 1234 > received.txt
Transfer a file "test.txt" between two hosts: Host A: nc -l 1234 < test.txt Host B: nc [host A's IP] 1234 > test.txt
Port scan a host to see which ports are open: nc -v -n -z example.com 1-1000