You want to share your Linux terminal session/application into 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. As of this writing, the latest
Extract downloaded file.
tar xvf gotty_linux_amd64.tar.gz
Give the binary file execution bit and move it to your
chmod +x gotty
sudo mv gotty /usr/local/bin/
You should be able to check Gotty version.
$ gotty -version
gotty version 1.0.1
How to Share your Linux Terminal in Web Browser with Gotty
Once you have Gotty installed, you can check its usage with
$ 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
$ gotty htop
2019/01/17 16:07:29 Server is starting with command: htop
2019/01/17 16:07:29 URL: http://127.0.0.1:8080/
2019/01/17 16:07:29 URL: http://[::1]:8080/
2019/01/17 16:07:29 URL: http://192.168.100.27:8080/
2019/01/17 16:07:29 URL: http://[fe80::fa2e:617f:c315:6983]:8080/
2019/01/17 16:07:29 URL: http://192.168.122.1: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.
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
$ 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
Using Config File
You can customize default options for GoTTY using a configuration file. The default profile file loaded if it exists is at
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
2019/01/17 16:43:47 Loading config file at: /home/jmutai/.gotty
2019/01/17 16:43:47 Server is starting with command: htop
2019/01/17 16:43:47 URL: https://127.0.0.1:19000/
2019/01/17 16:43:47 URL: https://[::1]:19000/
2019/01/17 16:43:47 URL: https://192.168.100.27:19000/
2019/01/17 16:43:47 URL: https://[fe80::fa2e:617f:c315:6983]:19000/
2019/01/17 16:43:47 URL: https://192.168.122.1:19000/
2019/01/17 16:43:47 TLS crt file: /home/jmutai/.gotty.crt
2019/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
$ 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.