Learn how "nc" lets you read and write raw TCP and UDP sockets for testing, file transfer and quick network plumbing. 15.04.2026 | reading time: 2 min Netcat, typically invoked as `nc`, is a compact command-line utility for reading from and writing to network sockets using TCP or UDP; use it to test services, transfer files, grab banners and prototype simple network protocols. Send a file between two hosts Start a listener on the receiver (hostA) and write incoming bytes into a file: ```bash # on hostA nc -l 12345 > received.txt # no prompt; waits for connection ``` On the sender (hostB) push a file to that listener: ```bash # on hostB nc 192.0.2.1 12345 < file.txt # exits when transfer completes ``` Quick verification on hostA: ```bash ls -l received.txt # shows the received file and size ``` Options that matter in practice Useful switches include `-l` to listen, `-p` to set a port, `-u` for UDP, `-w` to set timeouts, `-v` for verbose output and `-z` for zero-I/O port scans; note that `-e` (execute program on connect) exists in some variants but is a security risk and is omitted from others, so test behavior on your distribution before scripting. When to reach for other tools For encrypted tunnels use `openssl s_client` or a proper VPN; for protocol-aware bridging use `socat`; for scripted, feature-rich replacements try `ncat` from Nmap; `telnet` can still be handy for quick TCP checks but lacks features such as UDP and file redirection. Keep exploring and certifying Netcat is a hands-on way to learn sockets, ports and basic troubleshooting; experiment safely in an isolated lab, then deepen skills and credentialize them with CompTIA Linux+ or LPIC-1 preparation such as the intensive courses at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. network utilities security troubleshooting scripting