I run a small Minecraft server on an Ubuntu PC in my house. Sometimes I have to manage the server outside of my home so I use an ssh client on my phone. This works, but each time I close the app and then relaunch I have to create a new terminal session. How can I toggle to the existing one?
I suggest you install and keep
screen
running. It's a terminal multiplexer, in other words - terminal session splitter.You have to have
multiuser
mode enabled to that you can attach to that session. So inside the terminal on the server, press Ctrl+a , then immediately Shift+;. The bottom of the screen will highlight and you will see a semicolon there. Type inmultiuser on
.Now, from another computer you can SSH into your server, and type in
screen -ls
to know the title of the session. Example:Type in
screen -x sessionTitle
to attach. Example:Now you're back to the existing session.
To detach, use Ctrl+A, followed by d