Quick cheat sheet for reference:
Concepts: Session, window, pane. You can also multiple tmux sessions, each of them can have multiple window, and each window can have multiple panes.
tmux new -s work # create a new session
Ctrl+b, then c # add a window to a session
Ctrl+b, then 1 # switch to window 1 in the same session. You can change 1 to other numbers.
Ctrl+b, then % # add a pane to window
Ctrl+b, then o # switch panes in the same window
Ctrl+b then d # detach a session
tnum attach -t work # re-attach to session 'work'
tmux a # re-attach to the last session used
Ctrl+d # kill a pane, a window, a session
Some bioinformatics software pipeline need long time to run and need us to monitor the progress from time to time. But we often can not keep our computer always on to keep the linux session on. Also the internet connection may get lost, then you will miss the session.
Thanks to the Linux developers for the tmux command, which can easily help us keep as many sessions as we want alive.
Jump start: If you don't want to understand the details, here is my simple and easy way to use tmux.
First, login to O2 using Linux/Mac terminal or Putty on Windows. Next you can start a tmux session:
Please notice, we started the tmux session on login01 here. Your node (computer) may be login02 or any other login nodes. You need remember it so you can come back later.
Now you should have a window like:
So there are 1 windows (0:bash*) inside this session. The * means the window is active now.
To add one more window, you can type Ctrl+b (hold the ctrl or control key, then type "b"), then c. You get something like:
So there are two windows now, 0:bash- and 1:bash*. And 1:bash* is active window now.
When you need turn off your computer or log out of O2, You can type Ctrl+b, then d for detach the session.
When you want to go back to the previous session, first log on to O2 as before, check if you land on the original tmux session's starting node or not, if not ssh to the original node (computer), then re-attach:
Or if you just want to go the most recent active session:
If you want additional pane in a window, please type Ctrl + b, then %, then you got:
Now type Ctrl + b, then o switch to the first pane, run this command:
Now type Ctrl + b, then o switch to the second pane, run this command:
So you can monitor process running status from the seond pane while the software is running in the first pane:
# For Detail: please refer to this page: https://github.com/tmux/tmux/blob/master/README