Get top from http://localhost:8081 (on linux use top -n 1). while :; do nc -l 8081 <<EOF HTTP/1.1 200 OK Content-Type: text/html <pre>`top -l 1`</pre> EOF done