Simple way to transmit files over network (nc utility)

There are many ways to transmit files between computers over the heterogeneous network (Linux, Windows, Apple MAC and other systems). I used to run SCP for my every day administrative tasks, especially when client SCP utility is available for Windows too.

But here is useful tip on how to transmit files over network with no need to install and configure any service at server: just run at Linux or Unix server simple command:

nc -l -p 12345 < /etc/apache/httpd.conf

After this file /etc/apache/httpd.conf will be available at 12345 TCP port at any server’s IP address. To get it just load with any browser you like (192.168.0.7 is server’s IP) at client’s PC. After file is downloaded it’s impossible to download it again without restarting nc command. Here are the results of my example:

nc-terminal.png

nc

Theoretically it shouldn’t work as there are no web server headers like Content-type or Status. But it works. Ideas why it’s so are highly appreciated 🙂

You might also be interested in:
Web server on bash (in one line!)

SHARE:
nv-author-image

Stefan Durand

My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.

1 thought on “Simple way to transmit files over network (nc utility)”

  1. I think that those headers are just directive for our browsers. The browser show everything it receive, except headers, and you have written it plain text.

Leave a Reply

Your email address will not be published. Required fields are marked *