Web server in one line of shell code

If you want to quickly save a file through http but you don’t want to install a web server, you can just use netcat.

You can run:

 while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; cat index.html; } | nc -l 8080; done 

index.html can be any file you want to serve it.

You can access it after that as: http://<YOUR HOST>:8080/