Dup Ver Goto 📝

Creating Sessions and Screens 1

PT2/linux/tmux tmux does not exist
To
48 lines, 226 words, 1406 chars Page 'CreatingSessionsAndScreens1' does not exist.

To Create A Session

tmux new-session -s turnip
tmux new-session -d -s cityscape    # start detached

To Create A Window

tmux new-window -n <new-window-name> -t <session-name> <cmd>
tmux new-window -n <new-window-name> -t <session-name>:<window-number> <cmd>

Explicit Window Number

To avoid the

create window failed: index 2 in use

error use an explicit window number:

tmux new-window -n <new-window-name> -t <session-name>:<n> <cmd>

Example

This is a random script from my pi3 which starts up some services written in Python.

#!/bin/bash
start_wol_all() {
  (
  cd ~/wol
  tmux new-session -d -s wol
  sleep 1
  tmux new-window -n mpdmgr_http -t wol:1 p mpdmgr_http.py
  sleep 1
  tmux new-window -n wolsrv_http -t wol:2 p wolsrv_http.py
  sleep 1
  tmux new-window -n wolsrv -t wol:3 p wolsrv.py
  )
}
start_wol_all