Ships with macOS
Recommendedsystemnc -h
Read and write network connections from the terminal
Netcat opens a TCP or UDP socket and connects it to standard input and output. That single idea covers banner reading, port reachability checks, ad-hoc file transfer between two lab hosts, and a quick listener to see what a client sends.
Two lineages exist — OpenBSD netcat and GNU netcat — with different flags. Check `nc -h` on your system rather than trusting a blog post, and note that the `-e` execution option is deliberately absent from hardened builds.
Supported platforms
8
Documented install or usage guidance
Learning curve
beginner
Difficulty of becoming productive, not of the underlying theory
Tags
tcp, udp, listener, transfer, diagnostics
Dataset entry
netcat.ts
Reviewed 2026-01-08
Grouped by platform. Elevation requirements are marked per method.
nc -h
Needs elevated privileges (sudo / Administrator).
sudo apt install netcat-openbsd
nc -h
sudo dnf install ncat
Package availability follows your distribution and enabled repositories. Entry revised 8 Jan 2026 — confirm the current release on the project's own download page.
Every command carries its purpose, an example where useful, and the limitations that change how you should read the output.
Opens a connection and prints what the remote side says first.
nc -nv 192.0.2.10 25
Example output
Illustrative only — real output depends on the target, version and your position on the network.
220 mail.internal ESMTP Postfix
The `-z` scan reports whether a connection succeeds, which answers firewall questions faster than a full port scan.
nc -zvu 192.0.2.10 53
Notes
Accepts one connection and prints what arrives — used to confirm a client's outbound path in a lab.
nc -nlvp 9001
Notes
The classic single-stream copy: no daemon, no scp dependency, useful on minimal images.
nc -l 9000 > received.bin
Example
sender: cat payload.bin | nc 192.0.2.20 9000
Forwards a local port so a tool that only speaks to localhost can reach a lab service.
nc -L -p 8080 -r 192.0.2.10:80
Notes
Confirm a specific port is reachable from a specific source.
See exactly what a device sends when it connects.
Move a small file when no package manager is available.
Symptoms you will actually hit, with the cause and the legitimate fix.
Possible causes
Usual fix
Use a high port (1024+) or run with sudo on a lab machine.
Possible causes
Usual fix
Check `nc -h` and `readlink -f $(which nc)`; write scripts against one named binary (for example `ncat`) instead of `nc`.
Not documented yet: socat, ncat, openssl s_client. Request an entry and it will link up automatically.Request a tool
Side-by-side
Where to verify anything on this page. External links open in a new tab.