We can have multiple sessions on TMUX and in a session, we can have multiple windows, and in a window we can have multiple panes. So cool, isn’t it?
To see the list sessions of TMUX, use this command
$ tmux ls
or
$ tmux list-sessions
If you already have existing session/s of TMUX, then you can attach one of them, so when you open TMUX again, it will be the default session opened by TMUX. This is the command to attach session.
# in terminal
$ tmux attach-session -t sessionName
If you are in the other session of TMUX, you can attach other session and move to them using the leader key combination and the s key. <ctrl + b> s. TMUX will display all the sessions available and you can use one of them using the arrow key or the j, k key.
To start TMUX with a new session from the terminal, use this command
$ tmux
or
$ tmux new
or
$ tmux new-session
To start TMUX new session in the existing TMUX session, use this command
# press ctrl + b ( or your own mapping keys for the leader keys
:new
or
:new -s sessionName
To kill the current session ( the one with attached word when you display list sessions ) using this command
# press leader key combination <ctrl + b>
:kill-session
Warning, this will kill the attached session and exit the TMUX session.
Summary
Ok, here are the summary
# New Session
$ tmux
$ tmux new
$ tmux new -s sessionName
or, if you are in one of the TMUX session, use this command
:new
:new -s sessionName
# List Sessions
$ tmux ls
$ tmux list-sessions
or, if you are in one of the TMUX session, use this command
<ctrl + b> s, then choose the session from the sessions list
# Attach Session
$ tmux attach-session -t sessionName
or, if you are in one of the TMUX session, use this command
:attach -t sessionName
# Kill Session
# tmux kill-session -t sessionName
or, if you are in one of the TMUX session, use this command
:kill-session -t sessionName
Hope you will found this useful. Cheers 🙂
You must be logged in to post a comment.