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 http://192.168.0.7:12345 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!)

 
 
» You might also be interested in the following articles:
Manage gzip files on-the-fly (zcommands)
Encryption files with GPG without user intervention (batch)
Secure shell (ssh) session timeout
Combined traceroute and ping utility (mtr)
Keep ssh session saved (Unix “screen” utility)



» Want to stay up to date? Subscribe to our E-MAIL or RSS feed!

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


  1. 1 TheWorm

    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




Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | Linux config Wiki | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
Linux HOWTOs, Tutorials & Projects with Adam Palmer | LinuxAlt.Com
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››