A Bash web server
One Liners
 
        		    			© Lead Image © valenty, 123RF.com
		    Article from Issue 250/2021
	        
	    	    		
                
	    	    With one line of Bash code, you can create a Bash web server for quickly viewing the output from Bash scripts and commands.
For people who do a lot of work with command-line tools or Bash code, having a Bash web server could be very handy. I was really amazed that in one line of Bash code I was able to create web servers that could:
- Send the output from a Bash command directly to a browser page
- Create diagnostic pages using standard Linux tools
- Create pages that view Raspberry PI GPIO pins
- Create a page to toggle a Rasp PI GPIO pin
One-Line Web Servers
While a number of minimal, one-line web servers exist in most programming languages [1], you can create a Bash web server using the networking utility nc (or netcat) as follows:
[...]
Use Express-Checkout link below to read the full article (PDF).
        	Buy this article as PDF
Express-Checkout as PDF
			
			    Price $2.95
(incl. VAT)
			(incl. VAT)


