This Tool Lets You Share Your Terminal Over the Web

Do you want you to quickly share your terminal session with someone without several layers of hassle? With Ttyd, you can. This small utility transforms your terminal into an interactive web application live. No screen sharing. No delicate configuration. Just your terminal, on the web, ready to leave.

What is Ttyd and how it works

TTYD is a light command line that allows you to share your terminal on the web with a single order. You do not need a complicated configuration or any other third -party service. It is a simple way to transform your local terminal into a local terminal into a web.

Basically, Ttyd envelops any order you want (like a shell like Bash or Zsh) and serves it via a secure interface based on a browser. You start it and it launches a web server that anyone connected to your network can access to interact with your terminal in real time, directly from their browser. Think about it as screen sharing for your terminal, only more interactive and accessible.

Whatever the activities that others on the shared terminal occur in real time on your system and remain permanently. For example, you share a terminal session. Someone is entering this session and creates a new file. This file is really created on your system and remains there. So everything is synchronized.

Especially if you open your ttyd server on the wider web, it is practical for remote management, fast demos, collaborative troubleshooting or even the management of a headless device from far. It is also fast and responsive due to being created with Libuv and WebGL2.

It also means that if your session falls into the hands of the bad person, things can become embarrassing. However, Ttyd comes with several safety mechanisms, which I will show you later.

Related

11 neglected linux commands that you should really use

These orders could considerably improve your workflow!

Installation of ttyd on Linux

You can install Ttyd in several ways on Linux. The developers recommend downloading the installation binary from the official Github page for installation. Access the versions page. Choose the binary version adapted to your system.

Download the binary file ttyd from GitHub.

I will go with the X86_64 version because this is what my system supports. You can also use the WGET command to download the file.

wget https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64

Note that your order can change slightly depending on the latest version of the binary as well as the architecture. Once downloaded, provide an executable authorization to the file via CHMOD.

chmod +x ttyd.x86_64

If you have configured Homebrew, you can use it to install TTyD.

brew install ttyd

If you have a Snap activated on your system, you can also use it.

sudo snap install ttyd --classic

If you want to create the application from source, it is also possible. First, update your system.

sudo apt-get update

Install the dependencies and tools necessary with this command:

sudo apt-get install -y build-essential cmake git libjson-c-dev libwebsockets-dev

Clone the GitHub repository, go to the “Ttyd” repertoire, create a “build” repertoire and sail.

git clone https://github.com/tsl0922/ttyd.git
cd ttyd && mkdir build && cd build

Finally, create the application.

cmake ..
make && sudo make install

For a demonstration, I will use the application from the GitHub version page.

Use of ttyd to share your terminal on the web

Ttyd’s basic syntax is like this:

ttyd [options] [command] [arguments...]

For simple use, place any Linux command to Ttyd.

ttyd bash
Creation of a simple ttyd session on the web.

This created a web server session on http: // Localhost: 7681. Visit the URL on your web browser to see it.

Access the Linux terminal on the web via TTYD.

The default is 7681. If you want to change the port, you can do so by adding the -P option.

ttyd -p 7777 bash

This time, you will have to visit http: // localhost: 7777 to find the session. You can also display various terminal tools. Let’s try Vim.

ttyd vim
Sharing a VIM session on the web via TTYD.

Even the superior tool or any other system monitoring software.

ttyd top
Sharing a higher session on the web via TTYD.

Exploration of advanced options

There are many options in TTYD that make your session more interactive and fruitful. The default sessions that I created earlier were reading alone. This means that you cannot write anything in the browser terminal. To make it written, you must pass the -W or -warden option.

ttyd -W nano
Creation of a writer session using Ttyd.

You can add the connection system of your device to your part.

ttyd -W login

If you are facing root authorization errors, previous with the Sudo command.

sudo ttyd -W login

You also need the -W option to type your username and password.

Connection with your system account in a TTYD session.

If you want to add security to your session, you can add a username and password authentication using the -C option.

​​​​​ttyd -c user:password bash
Creation of a TTYD session with authentication.

With this, any user trying to join the session will have to enter a username and password. There are also other safety options, such as adding SSL encryption.


There are many more things to try in Ttyd. If you are stuck or if you want to explore more, try to use the -H indicator to display the help mode to check the available options. You can also check the official github for more information. Many large Linux tools allow you to share your Android screen or even record fast terminal sessions.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button