Netcat
Tool manual · Kali & common usage
Network · Beginner · Network lane
What is Netcat?
Netcat (nc) reads and writes raw TCP/UDP. It is a Swiss-army knife for connectivity tests, simple listeners, and data transfer in labs.
Check if a port accepts connections, stand up a quick listener, or move text between shells — authorized use only.
Official website: Netcat · Documentation
When do you use it?
- Test whether host:port is reachable through a firewall.
- Simple chat/listener demo on localhost.
- Banner grab on authorized services.
When not to use it
- Not a full C2 framework — do not use for unauthorized access.
- For HTTP APIs prefer curl; for scans prefer nmap.
Who uses it?
- Network engineers
- SOC analysts
- Penetration testers
How do you use it? (typical flow)
- Install Netcat using the steps below (prefer Kali package or official installer).
- Confirm you have authorization for the target (lab VM, own system, or written scope).
- Run --help / man (or the Help section) to see current flags for your version.
- Start with a safe example from Basic commands against localhost or an authorized lab target.
- Record what you ran, what you observed, and any follow-up (filter, report, remediation).
Help & manual (like man / --help)
Every serious tool has a built-in way to look up flags. Learn these first so you are not stuck memorizing every option.
1. Help
nc -h
Flags differ slightly by netcat flavor.
2. Man page
man nc
OpenBSD nc man page on many Kali installs.
Kali Linux
Preinstalled on Kali as nc (openbsd-netcat or traditional). Check: nc -h
1. Installation
| OS | Installation |
|---|---|
Kali Linux | Preinstalled on Kali as nc (openbsd-netcat or traditional). Check: nc -h |
Debian/Ubuntu | sudo apt install netcat-openbsd |
macOS | Preinstalled (nc) |
2. Basic commands
1. Listen
nc -lvnp 9000
Listen on 9000 (flags vary by build).
2. Connect
nc 127.0.0.1 9000
Connect to your listener.
3. Port check
nc -zv 127.0.0.1 22
Zero-I/O probe if supported.
Options / flags
| Option | Purpose |
|---|---|
-l | Listen mode |
-v | Verbose |
-z | Scan without sending data |
-u | UDP mode |
5. Useful features
- Listening vs connecting
- Banner grabbing
- Port connectivity tests
6. Practical examples
Example 1: Listen
nc -lvnp 9000
Listen on 9000 (flags vary by build).
Example 2: Connect
nc 127.0.0.1 9000
Connect to your listener.
Example 3: Port check
nc -zv 127.0.0.1 22
Zero-I/O probe if supported.
7. Important notes
- Admins use it to test whether a port is reachable through a firewall.
- Authorized targets only — labs, systems you own, or written permission.
- Prefer reading --help / man / official docs for your installed version; flags change over time.
Related course: networking fundamentals · network security · Commands: /commands#networking