1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2024-11-01 23:17:56 +01:00
tldr/pages/common/nc.md
2016-01-08 09:38:59 +01:00

502 B

nc

Reads and writes tcp or udp data.

  • Listen on a specified port:

nc -l {{port}}

  • Connect to a certain port (you can then write to this port):

nc {{ip_address}} {{port}}

  • Set a timeout:

nc -w {{timeout_in_seconds}} {{ipaddress}} {{port}}

  • Serve a file:

cat somefile.txt | nc -l {{port}}

  • Receive a file:

nc {{ip_address}} {{port}} > somefile.txt

  • Server stay up after client detach:

nc -k -l {{port}}

  • Client stay up after EOF:

nc -q {{timeout}} {{ip_address}}