This guide will help you learn to use Screen. Screen is a fantastic tool for keeping Tellor clients (and other command line based applications) running on hosted machines when you don’t have the window open on your client machine. These methods can be used with AWS (or other VM) instances running Ubuntu or any other Linux OS.
Screen is a fantastic tool for organizing multiple terminals running multiple processes using only the cli. It’s super helpful when you’re working with virtual machines via SSH connection. Screen allows you to create as many terminal “windows” as you like, and the processes running in those windows will run continuously until you open that screen again and shut down the process. Let’s get started.
- For practice: An AWS virtual machine or other remote computer running Linux (like ubuntu).
1) First, let’s check if screen is installed. If you’re using Ubuntu, it’s most likely already installed.
If not installed, install screen with the command:
sudo apt install screen
2) Start a new screen session. We will use the -S flag and give our screen session a name (window1) with the command:
screen -S window1
You will be taken to the fresh screen “window” you just created. We’re going to exit this screen in a minute, but for now type anything you like so that you can identify this window later. Your terminal window should look about like this:
3) Exit the screen session using the keyboard shortcut [CTRL+a+d]. This will take you back to the “main” VM window that you started with. Check your open screen sessions with the command:
This will output a list of screen sessions including the one you just made named “window1”. It should look like this:
4) Reconnect to window1 with the command:
screen -r window1
You should see your message from before in all it’s glory:
We don’t have any processes running in this example, but If you had a program running we would see the log here chugging away.
5) When you’re done with a screen window, there is a simple keyboard shortcut for closing it. While connected to window1, use [CTRL+c] to end processes and clear the terminal. Then use [CTRL+d] to terminate the screen. This will take you back to that “main” window. Listing screens again will show that you have no screens open:
Note: We made just a single screen in this example, but you can make as many as you’d like as long as it doesn’t crash your VM. I use this method for running various Tellor clients and it works like a charm!
Thanks for Reading!
Have a great day 🤙