Command library / nc
nc
Read and write raw data across a network connection
The network Swiss Army knife: connects to a port like a client (-nv host port), or listens for a connection like a server (-lvp port). Endlessly useful for banner-grabbing, quick port checks, transferring files, and — most famously — catching a reverse shell.
Practice ncUsage
Options and flags
hosttarget host to connect to (client mode only)
portthe port to connect to or listen on
-l, --listenlisten for an incoming connection instead of connecting out
-v, --verboseverbose output — show what's happening
-nnumeric only — skip DNS resolution
-pPORTthe local port to use (mainly with -l)
Examples
nc -nv 10.10.10.5 80Connect to port 80 and see what greets you — a manual banner grab.
nc -lvp 4444Listen on port 4444 for an incoming connection — the classic reverse-shell catcher.
Common mistakes
When listening, the port needs -p in front of it — without it nc reads '4444' as a host to connect to, not a port to listen on.