netcat – swiss army knife for TCP/IP

May 13, 2013
linux computer-networking

They say it’s the “swiss army knife for TCP/IP”. They say it right!

I’ve seen netcat or we should simply say nc, in action a lot many times. When you can’t move files through the traditional SSH or FTP for “various” reasons, nc comes as a great savior.

It’s easy to create a socket server listening on one port.

nc -l 17000

The above command will start a server listening on port 17000. Let’s imagine the server’s ip address being 192.168.0.10. To connect to the server we have to do:

nc 192.168.0.10 17000

A server-client connection will be established and anything we type will be visible on both consoles. We can take things further and use netcat to transfer files. This time we start the server in receiving mode:

nc -l 17000 > openSUSE-12.3.iso

Yeah … I couldn’t take any other file as example (: To send the iso file from the other end we do :

cat openSUSE-12.3.iso | nc 192.168.0.10 17000

You can combine several utilities together and the most done using netcat.

City Council of Barcelona switches from Microsoft Windows to Linux

February 11, 2018
linux ubuntu microsoft open source data protection

linux.com website compromised?

December 7, 2017
linux wordpress security

Linux Magazine's special edition on openSUSE

November 20, 2017
opensuse linux university-of-mauritius education