Tuesday, November 18, 2014

tail a *nix command in your browser

if you have bash or zsh:

command | cat -u <( echo $'HTTP/1.0 200 OK\nContent-type:text/plain\n\n' ) - | nc -l 8080

otherwise:

echo $'HTTP/1.0 200 OK\nContent-type:text/plain\n\n' > header.txt
command | cat -u header.txt - |  nc -l 8088

enjoy the output on http://localhost:8080