Tmux

Start new session

$ tmux new -s [session_name]

Detach from session

ctrl + B, d

List sessions

tmux ls

Re-attach session

tmux attach -t [session_name]

Re-attach to last session, otherwise new one

tmux attach || tmux new

Start command in tmux

tmux new-session -s abc 'my_command'

Start command in tmux in the bg

tmux new-session -d -s abc 'my_command'

Using tabs

  • ctrl + b c: new tab
  • ctrl + b NUMBER: go to tab NUMBER

Bootstrap

#!/bin/bash  
  
tmux ls | grep '#!' > /dev/null || (  
 tmux new-session -d -s '#!' -n 'chat' "weechat"  
 tmux new-window -n 'mail' 'firejail mutt'  
 tmux new-window -n 'shell' -a  
)  
exec tmux attach -t '#!'