Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tmux shortcut to create a new session?

Tags:

tmux

Just like leader_key + C creates a new window inside a session. Is there a similar shortcut for creating a new session ? Currently, I use leader_key + new

like image 421
ankitj Avatar asked Dec 09 '25 22:12

ankitj


2 Answers

Why not just create a keybinding for that in your .tmux.conf?

These two settings let you create/kill a new session when pressing Prefix S (Shift+s) or Prefix K (Shift+k) respectively:

bind S command-prompt -p "New Session:" "new-session -A -s '%%'"
bind K confirm kill-session

Prefix Shift+s will open a command prompt in the status line, asking for a new session name. It will either create a new session with that name or attach to an already existing session by that name.

like image 96
m4110c Avatar answered Dec 14 '25 02:12

m4110c


There are no predefined shortcuts, the only native way to do it is :

  • Create session: tmux new -s session_name

  • Ctrl-B + d to detach

  • Return to your session: tmux attach-session -t session_name

like image 23
Olivier Cartier Avatar answered Dec 14 '25 01:12

Olivier Cartier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!