Top Related Projects
Quick Overview
ttyd is a simple command-line tool that turns your terminal into a web application. It allows you to share your terminal over the web, providing remote access and collaboration capabilities. ttyd is built with C and JavaScript, offering a lightweight and efficient solution for web-based terminal access.
Pros
- Easy to set up and use, with minimal configuration required
- Supports various authentication methods for secure access
- Cross-platform compatibility (Linux, macOS, Windows)
- Customizable interface with themes and responsive design
Cons
- Limited advanced features compared to full-fledged remote access solutions
- Potential security risks if not properly configured
- May require additional setup for use behind firewalls or proxies
- Performance can be affected by network latency
Getting Started
To get started with ttyd, follow these steps:
-
Install ttyd:
# On Ubuntu or Debian sudo apt-get install ttyd # On macOS using Homebrew brew install ttyd # On Windows using Scoop scoop install ttyd
-
Run ttyd with a command:
ttyd bash
-
Access the terminal in your web browser:
http://localhost:7681
For more advanced usage and configuration options, refer to the project's documentation on GitHub.
Competitor Comparisons
Share your terminal as a web application
Pros of GoTTY
- Written in Go, which may be more familiar to some developers
- Simpler codebase, potentially easier to understand and modify
- Supports custom command execution with arguments
Cons of GoTTY
- Less actively maintained (last commit over 2 years ago)
- Fewer features compared to ttyd (e.g., no multi-user support)
- Limited configuration options
Code Comparison
GoTTY:
func main() {
app := cli.NewApp()
app.Name = "gotty"
app.Version = Version
app.Usage = "Share your terminal as a web application"
// ...
}
ttyd:
int main(int argc, char **argv) {
int opt;
char *port = "7681";
char *interface = NULL;
char *credential = NULL;
// ...
}
Both projects aim to share terminal sessions via web browsers, but ttyd offers more features and active development. GoTTY's simplicity may appeal to some users, while ttyd's broader functionality and ongoing support make it more suitable for complex use cases. The code snippets show different programming languages and approaches, with GoTTY using a CLI framework and ttyd implementing a more traditional C-style main function.
A terminal workspace with batteries included
Pros of Zellij
- Built-in multiplexer functionality, allowing multiple panes and tabs within a single terminal window
- Rust-based, offering better performance and memory safety
- More feature-rich with plugins and customizable layouts
Cons of Zellij
- Steeper learning curve due to more complex functionality
- Requires local installation, not as easily accessible via web browsers
Code Comparison
Zellij (Rust):
use zellij_tile::prelude::*;
#[derive(Default)]
struct State;
register_plugin!(State);
impl ZellijPlugin for State {
fn update(&mut self, event: Event) -> bool {
// Handle events
}
}
TTYD (C):
#include <libwebsockets.h>
int main(int argc, char **argv) {
struct lws_context_creation_info info;
memset(&info, 0, sizeof(info));
// Configure and start the server
}
Summary
Zellij is a feature-rich terminal multiplexer with a focus on customization and performance, while TTYD is a simpler solution for sharing terminal sessions over the web. Zellij offers more advanced functionality but requires local installation, whereas TTYD provides easier web access but with fewer features.
The easiest, and most secure way to access and protect all of your infrastructure.
Pros of Teleport
- More comprehensive security features, including role-based access control and multi-factor authentication
- Supports multiple protocols (SSH, HTTPS, RDP) and can be used for various infrastructure components
- Offers advanced auditing and session recording capabilities
Cons of Teleport
- More complex setup and configuration compared to ttyd's simplicity
- Requires more resources to run and maintain
- May be overkill for simple web-based terminal access needs
Code Comparison
ttyd:
int main(int argc, char **argv) {
struct lws_context_creation_info info;
memset(&info, 0, sizeof(info));
info.port = 7681;
info.iface = NULL;
info.protocols = protocols;
}
Teleport:
func main() {
app := utils.InitCLIParser("teleport", "SSH infrastructure management")
commands := []cli.Command{
Start,
Configure,
Status,
}
app.Commands = commands
}
Summary
While ttyd focuses on providing a simple web-based terminal, Teleport offers a more comprehensive solution for secure infrastructure access. ttyd is lightweight and easy to set up, making it suitable for basic terminal sharing needs. Teleport, on the other hand, provides enterprise-grade security features and supports multiple protocols, but comes with increased complexity and resource requirements.
🐛 Access your terminal from anywhere via the web.
Pros of rtty
- Designed specifically for embedded systems and IoT devices
- Supports SSL/TLS encryption for secure connections
- Includes a built-in file transfer feature
Cons of rtty
- Less active development and smaller community compared to ttyd
- Limited platform support, primarily focused on OpenWrt
- Fewer customization options and features for non-embedded use cases
Code Comparison
rtty (client-side connection):
struct rtty *rtty = rtty_new(host, port, token, description);
if (rtty) {
rtty_connect(rtty);
rtty_run(rtty);
rtty_free(rtty);
}
ttyd (server-side setup):
server = libwebsocket_create_context(&info);
if (server == NULL) {
lwsl_err("libwebsocket init failed\n");
return 1;
}
libwebsocket_service(server, 50);
Both projects aim to provide web-based terminal access, but they have different focuses. rtty is tailored for embedded systems and IoT devices, offering features like SSL/TLS encryption and file transfer. However, it has a smaller community and limited platform support compared to ttyd.
ttyd, on the other hand, is more versatile and supports a wider range of platforms. It has a larger community and more active development, making it suitable for various use cases beyond embedded systems. ttyd also offers more customization options and features for general-purpose terminal sharing.
The code comparison shows that rtty uses a client-side approach, while ttyd sets up a server-side WebSocket connection. This reflects their different design philosophies and target use cases.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
ttyd - Share your terminal over the web
ttyd is a simple command-line tool for sharing terminal over the web.
Features
- Built on top of libuv and WebGL2 for speed
- Fully-featured terminal with CJK and IME support
- ZMODEM (lrzsz) / trzsz file transfer support
- Sixel image output support (img2sixel / lsix)
- SSL support based on OpenSSL / Mbed TLS
- Run any custom command with options
- Basic authentication support and many other custom options
- Cross platform: macOS, Linux, FreeBSD/OpenBSD, OpenWrt, Windows
⤠Special thanks to JetBrains for sponsoring the opensource license to this project.
Installation
Install on macOS
Install on Linux
- Binary version (recommended): download from the releases page
- Install with Homebrew :
brew install ttyd
- Install the snap:
sudo snap install ttyd --classic
- Build from source (debian/ubuntu):
You may also need to compile/install libwebsockets from source if thesudo apt-get update sudo apt-get install -y build-essential cmake git libjson-c-dev libwebsockets-dev git clone https://github.com/tsl0922/ttyd.git cd ttyd && mkdir build && cd build cmake .. make && sudo make install
libwebsockets-dev
package is outdated. - Install on OpenWrt:
opkg install ttyd
- Install on Gentoo: clone the repo and follow the directions here.
Install on Windows
- Binary version (recommended): download from the releases page
- Install with WinGet:
winget install tsl0922.ttyd
- Install with Scoop:
scoop install ttyd
- Compile on Windows
Usage
Command-line Options
USAGE:
ttyd [options] <command> [<arguments...>]
OPTIONS:
-p, --port Port to listen (default: 7681, use `0` for random port)
-i, --interface Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)
-U, --socket-owner User owner of the UNIX domain socket file, when enabled (eg: user:group)
-c, --credential Credential for basic authentication (format: username:password)
-H, --auth-header HTTP Header name for auth proxy, this will configure ttyd to let a HTTP reverse proxy handle authentication
-u, --uid User id to run with
-g, --gid Group id to run with
-s, --signal Signal to send to the command when exit it (default: 1, SIGHUP)
-w, --cwd Working directory to be set for the child program
-a, --url-arg Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)
-W, --writable Allow clients to write to the TTY (readonly by default)
-t, --client-option Send option to client (format: key=value), repeat to add more options
-T, --terminal-type Terminal type to report, default: xterm-256color
-O, --check-origin Do not allow websocket connection from different origin
-m, --max-clients Maximum clients to support (default: 0, no limit)
-o, --once Accept only one client and exit on disconnection
-q, --exit-no-conn Exit on all clients disconnection
-B, --browser Open terminal with the default system browser
-I, --index Custom index.html path
-b, --base-path Expected base path for requests coming from a reverse proxy (eg: /mounted/here, max length: 128)
-P, --ping-interval Websocket ping interval(sec) (default: 5)
-6, --ipv6 Enable IPv6 support
-S, --ssl Enable SSL
-C, --ssl-cert SSL certificate file path
-K, --ssl-key SSL key file path
-A, --ssl-ca SSL CA file path for client certificate verification
-d, --debug Set log level (default: 7)
-v, --version Print the version and exit
-h, --help Print this text and exit
Read the example usage on the wiki.
Browser Support
Modern browsers, See Browser Support.
Alternatives
Top Related Projects
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot