Networking / Beginners


Netcat has often been described as the "Swiss Army knife" of troubleshooting tools. This is because its function is so elegantly simple that it has many uses. In essence, it establishes a communications session between two systems. You can enter nc -l -p 2222 to tell system one to listen on port 2222. On system two, the command nc 2222 would connect to system 1 (assuming the IP address is on port 2222. After the connection is established, anything typed at the console of either system is sent to the stdout of the other system. Although both ends of the session can be the netcat executable, they don't have to be. In addition to providing a command line based method for transferring data, netcat enables you to test connectivity over arbitrary ports. By entering nc <IP Address> 23, you can connect to a system to verify that Telnet is listening and available. In fact, if you use the -t switch, netcat will negotiate the Telnet specifics. Although Telnet is often used in exactly the same way to test connectivity to arbitrary ports (telnet <IP> <port>), netcat is more versatile in that it enables you to connect via TCP (the default) or UDP.

There are additional functions netcat offers to aid the network troubleshooter. Netcat can be configured to create a hex dump of the session (via the -o file option). It can also be configured to execute a program when a connection is made (potentially unsafe if not used carefully), or to restart itself in listen mode after a session is terminated. Netcat can be downloaded from; the last update was in January of 2004.A Windows version (1.1) can be downloaded from netcat/. Finally, a derivative project that adds twofish encryption is known as cryptcat and is available from, with versions for both Linux and Windows.There is also a very similar utility called socat, which is being actively developed. Socat is very close to netcat in function but features additional capabilities. Socat can be downloaded from

[Previous] [Contents] [Next]