We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Share your Linux Terminal Session in Web Browser

Learn how to – How To Share your Linux Terminal Session in Web Browser.

You want to share your Linux terminal session in a web browser?. GoTTY is a small Go application written specifically to enable you to turn your CLI tools into web applications. With GoTTY, the remote user can view terminal application being exposed on a web browser via a network connection.

Installing GoTTY on Linux

GoTTY is distributed as a binary package. Download the latest stable binary file from the Releases page using curl, wget or manually from a web browser.

cd /tmp
VER=$(curl -s https://api.github.com/repos/yudai/gotty/releases/latest|grep tag_name|cut -d '"' -f 4|sed 's/v//')
wget https://github.com/yudai/gotty/releases/download/v${VER}/gotty_linux_amd64.tar.gz

Extract downloaded file.

tar xvf gotty_linux_amd64.tar.gz

Give the binary file execution bit and move it to your $PATH folder.

chmod  +x gotty
sudo mv gotty /usr/local/bin/

You should be able to check Gotty version.

$ gotty -version
gotty version 1.0.1

Share your Linux Terminal in Web Browser with Gotty

Once you have Gotty installed, you can check its usage with --help option.

$ gotty --help

The general usage syntax is:

$ gotty [options] <command> [<arguments...>]

The example below will display Memory and CPU utilization of a Linux system as a web application. I’m using htop which can be installed on Ubuntu / Debian systems using:

sudo apt install -y htop

Then run:

$ gotty  htop
2023/01/24 21:12:56 Server is starting with command: htop
2023/01/24 21:12:56 URL:
2023/01/24 21:12:56 URL: http://[::1]:8080/
2023/01/24 21:12:56 URL:
2023/01/24 21:12:56 URL: http://[2a01:4f8:c17:f621::1]:8080/
2023/01/24 21:12:56 URL: http://[fe80::dc1d:b60f:4c3f:e7d3]:8080/

By default, GoTTY starts a web server at port 8080 but this can be changed. Open the URL given to view command output on a web browser.

GoTTY Authentication

Just running gotty command will not provide any authentication system for viewing terminal session on the web browser. Configure simple HTTP authentication for GoTTY using the options below

--credential user:pass


$ gotty  --credential admin:AdminPass htop

When you access provided URL, you’ll be asked to provide a username and password.

From my example, the username is admin, and password is AdminPass

Using Config File

You can customize default options for GoTTY using a configuration file. The default profile file loaded if it exists is at ~/.gotty

Let’s create a simple configuration file used when starting GoTTY application.

cat<<EOF > ~/.gotty
// Listen at port 19000 by default
port = "19000"

// Enable TSL/SSL by default
enable_tls = true

// Enable basic Authentication
enable_basic_auth = true
credential = "admin:AdminPassword"

// Permit Write - Enable only with Strong Authentication
permit_write = true

// Enable Random URL

random-url = true

See .gotty for a complete list of configuration options. If you enable SSL, generate certificates before starting gotty.

openssl req -x509 -nodes -days 9999 -newkey rsa:2048 -keyout ~/.gotty.key -out ~/.gotty.crt

Then start your GoTTY terminal application to display.

$ gotty htop
2022/01/17 16:43:47 Loading config file at: /home/jmutai/.gotty
2022/01/17 16:43:47 Server is starting with command: htop
2022/01/17 16:43:47 URL:
2022/01/17 16:43:47 URL: https://[::1]:19000/
2022/01/17 16:43:47 URL:
2022/01/17 16:43:47 URL: https://[fe80::fa2e:617f:c315:6983]:19000/
2022/01/17 16:43:47 URL:
2022/01/17 16:43:47 TLS crt file: /home/jmutai/.gotty.crt
2022/01/17 16:43:47 TLS key file: /home/jmutai/.gotty.key

Sharing with Multiple Clients

Use terminal multiplexers for sharing a single process with multiple clients. If you’re new to terminal multiplexers, check my previous guide on How to install and use tmux terminal multiplexer in Linux and Unix

For example, you can start a new tmux session named gotty with top command by the command below.

$ gotty tmux new -A -s gotty top

To connect to the tmux session from your terminal, you can use following command.

$ tmux new -A -s gotty

Enjoy sharing your Linux Terminal in Web Browser with GoTTY.

Similar guides:

Install Windows Terminal on Windows

Install Tilix GTK3 tiling terminal emulator on Ubuntu / Debian

How To Google Search from a Linux Terminal

Best Console / Terminal File Managers for Linux


Your Cart is Empty

Back To Shop