The cross platform WebSocket implementation for SH
JavaScript CSS Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Copyright (C) 2016 Anton Skshidlevsky (meefik), MIT

The cross platform WebSocket implementation for SH. It works on busybox and ash for embedded systems (requires installed busybox applets).

Bash shell as a web terminal

Run web server httpd in directory. For JQuery Terminal Emulator:

cd jquery.terminal
WS_SHELL="sh" httpd -p 8080

For Terminal.js:

cd terminal.js
WS_SHELL="bash -i" httpd -p 8080

For xterm.js:

cd xterm.js
telnetd -p 5023 -l /bin/sh -f /etc/issue
WS_SHELL="telnet 5023" httpd -p 8080

Open the terminal in browser: http://localhost:8080/cgi-bin/terminal

Custom usage


WS_SHELL="sh" nc -l -p 5000 -e

Use from browser:

var port = 5000;
var ws = new WebSocket('ws://' + location.hostname + ':' + port);
ws.onmessage = function(msg) {
    // convert base64 to string
    var data = atob(;
    // decode utf-8 chars
    data = decodeURIComponent(escape(data));
    console.log('Received data: ', data);
ws.onclose = function() {
    console.log('Connection closed.');
// send command: ls /
var data = 'ls /';
// encode utf-8 chars
data = unescape(encodeURIComponent(data));
// convert string to base64
data = btoa(data);

Multiple socket connections

You can use busybox inetd for multiple connections to single port for

export WS_SHELL="/path/to/"
inetd -e -f /path/to/inetd.conf
# /path/to/inetd.conf
5000	stream	tcp	nowait	root	/path/to/