Use tmux to manage your remote server

Concepts: one sesson can have multiple windows, and one window can have multiple panels.

Suppose now you just ssh to your remote server.
First create a new tmux session. By default, it has one window and one panel in it.

1
tmux

Give the session a meaningful name, so that you can later attach to it easily

1
<prefix> $

Give the current window a meaningful name

1
<prefix> ,

Split the current panel

1
2
<prefix> % // horizontally
<prefix> " // vertically

Oops, you create a new panel by mistake. Let’s close it

1
<prefix> x

And now you have too many panels in one window, let’s create a new window

1
<prefix> c

Switch between windows

1
2
<prefix> n // to next
<prefix> p // to previous

And close a window

1
<prefix> & // close a window

Now you have your work done. While closing your connection to remote server, you want your program keep running.
Or, you want to pick up where you was later. It’s easy, just detach the session

1
<prefix> d

Serval days later, you come back and want to resume your work. First, list all session alive in the backend.

1
tmux ls

Attach to your desired session by name

1
tmux a -t <name>

These commands are pretty much you need for tmux.