Understanding Netcat (nc): Functions, Common Parameters, and UDP Connectivity Test
This article explains what netcat (nc) is, outlines its primary functions such as listening on TCP/UDP ports, scanning, file transfer and speed testing, details common command‑line options, and demonstrates how to test UDP connectivity with an example command.
nc is the abbreviation for netcat, often called the Swiss army knife of networking because of its compact size and practical functionality, designed as a simple and reliable network tool.
Its main capabilities include listening on any TCP or UDP port (acting as a server), scanning ports by initiating TCP/UDP connections as a client, transferring files between machines, and performing network speed tests.
Commonly used parameters are:
-l : puts nc in listening mode, acting as a server.
-p : (rarely needed in newer versions) specifies the port number before the address.
-s : sets the source IP address for machines with multiple network interfaces.
-u : forces use of the UDP protocol (default is TCP).
-v : enables verbose output, useful for debugging.
-w : sets a timeout in seconds.
-z : zero‑I/O mode, used for scanning without sending data.
To test UDP connectivity, the article shows the command:
nc -vuz 150.236.211.171 161
Since UDP ports cannot be tested with telnet, nc can be used for scanning; the -u flag selects UDP, -v provides visual output, and -z performs a scan without transmitting data.
The author concludes by asking readers to like, follow, and share the article, and provides a WeChat contact (DaDangJia-01) for further learning resources.
Practical DevOps Architecture
Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.