Raspberry Pi

Share Raspberry Pi Terminal – Install GoTTY

GoTTY is a lightweight Go language-based command-line application that enables Raspberry Pi users to access and control the device terminal on their browsers. It turns your CLI tools into a web application, thus allowing you to see your Raspberry Pi terminal using the IP address of your device. It’s useful when someone wants to access your device terminal to work on a project.

In this article, we will show your how you can share your Raspberry Pi terminal by installing GoTTY.

Share Raspberry Pi Terminal: Install GoTTY on Raspberry Pi

You cannot install GoTTY directly on your Raspberry Pi device because the Raspberry Pi repository doesn’t have its repository. However, you can easily install this application by downloading the tar.gz file from the GitHub website. The steps to successfully perform the GoTTY installation on your Raspberry Pi device are given below:

Step 1: Download GoTTY tar.gz File

To download GoTTY tar.gz file on your Raspberry Pi device, you can use the following command:

$ wget -O gotty.tar.gz https://github.com/yudai/gotty/releases/latest/download/gotty_linux_arm.tar.gz

 

Step 2: Extract GoTTY contents From tar.gz File

After successfully downloading GoTTY tar.gz file, you can extract its contents through the below-mentioned command:

$ tar xf gotty.tar.gz

 

Step 3: Move GoTTY to Bin Directory

Next, you will need to move the GoTTY directory to the binary file location “usr/local/bin” using the following command:

$ sudo mv gotty /usr/local/bin

 

Step 4: Grant Permission to the File

After moving the GoTTY directory to binary file location, you will need to grant permission to the file using the following command:

$ sudo chmod a+x /usr/local/bin/gotty

 

Step 5: Check GoTTY Version

You can execute the following command to confirm the installation of the latest version of GoTTY on your Raspberry Pi device.

$ gotty --version

 

Step 6: Remove GoTTY tar.gz file

With the installation now successfully completed, you can remove the unnecessary GoTTY tar.gz using the following command:

$ rm -rf gotty.tar.gz

 

Step 7: Access Terminal From Browser

To access the Raspberry Pi terminal on your browser, you will first need to run the following command to run GoTTY service on your device:

$ gotty top

 

Within the terminal, you will be able to see the URL to access the GoTTY web interface on your browser.


Head back to your Raspberry Pi terminal, and use “CTRL+C” one time. When you see the message “Send ^C to force exit”, add the following command below this message and then press Enter.

$ gotty -w nano myfile.txt

 

Go back to your browser and reload the page again and you will be able to see your file opened on the browser and you can edit it easily without going back to your Raspberry Pi terminal.


The above image shows that you have successfully got access to your device terminal through GoTTY. You can also access the Raspberry Pi configuration on any browser by applying the following command:

$ gotty -w sudo raspi-config

 

 

The addition of “w” in the above commands is necessary as this allows you to manage the writing operation on your browser.

Removing GoTTY From Raspberry Pi

In case you no longer want to use the GoTTY service on your Raspberry Pi device, you can remove its binary file any time through the following command:

$ sudo rm -rf /usr/local/bin/gotty

 

Conclusion

GoTTY is a useful command-line utility that allows you to control the Raspberry Pi terminal from the browser. You can set up this application by downloading and extracting the tar.gz file on your Raspberry Pi and then executing the permission to the binary file to successfully install the utility on your device. To start working on your device terminal from the browser, you need to execute a command with “gotty -w” at the beginning so that you can access it on your browser.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.