# ttyd

> Command-line tool that shares a terminal command over the web, served via libuv and rendered in the browser with WebGL2, with SSL and basic auth.

Stars: 12.6k · Language: C · License: MIT · Categories: Network

- Repository: https://github.com/tsl0922/ttyd
- Website: https://tsl0922.github.io/ttyd
- Page: https://www.trmn.sh/tools/ttyd

## Install

- Homebrew: `brew install ttyd`
- apt (Debian/Ubuntu): `sudo apt install ttyd`
- Scoop (Windows): `scoop install ttyd`

## Overview

ttyd is a command-line server that exposes a terminal session in a web browser. You run it as `ttyd [options] <command> [<arguments...>]`, and it serves the given command (a shell or any other program) over HTTP and websockets on a configurable port (default 7681). The backend is built on libuv, and the browser frontend renders with WebGL2 using xterm.js.

The terminal supports CJK characters and IME input, ZMODEM (lrzsz) and trzsz file transfer, and Sixel image output (via img2sixel or lsix). Clients are read-only by default, and `-W` allows them to write to the TTY. Other options include `-o` to accept a single client and exit, `-m` to cap client count, `-a` to pass command arguments through the URL, `-w` to set the working directory, and `-u`/`-g` to set the uid and gid.

For access control and deployment, ttyd supports basic authentication (`-c user:pass`), delegating authentication to a reverse proxy via an auth header (`-H`), and origin checking (`-O`). It also supports SSL through OpenSSL or Mbed TLS with optional client certificate verification, binding to a network interface or UNIX domain socket, IPv6, and a base path for reverse proxy setups. It runs on macOS, Linux, FreeBSD/OpenBSD, OpenWrt, and Windows. Typical users are developers, sysadmins, and embedded or router operators who need browser access to a shell or command-line program without a separate SSH client.

### Installation

```bash
# via Homebrew
brew install ttyd
```

```bash
# via apt (Debian/Ubuntu)
sudo apt install ttyd
```

```bash
# via Scoop (Windows)
scoop install ttyd
```

![ttyd sharing a terminal in a web browser](https://media.trmn.sh/cached/9edd349c5adc98d44d7be8bdc68d0f077b9d71cd4b6e56056b0d95337a8666d1.gif)

## Alternatives

- [Nmap](https://www.trmn.sh/tools/nmap.md): Network scanner for host discovery, port scanning, service and OS detection, with a scripting engine (NSE) for extra checks. (C, 13.9k stars)
- [weechat](https://www.trmn.sh/tools/weechat.md): Terminal-based chat client with modular plugin architecture and multi-protocol support, primarily for IRC (C, 3.4k stars)
- [irssi](https://www.trmn.sh/tools/irssi.md): Terminal-based IRC client with modular architecture and support for multiple chat protocols (C, 3.2k stars)
- [elinks](https://www.trmn.sh/tools/elinks.md): Text-based web browser with frame/table support, scripting, and extensive customization options (C, 643 stars)
- [wrk](https://www.trmn.sh/tools/wrk.md): HTTP benchmarking tool that generates high load using multithreaded design and event notification systems (C, 40.4k stars)

---

Canonical: https://www.trmn.sh/tools/ttyd
