- Published on
List Tmux sessions
Tmux is one of the most useful tool when it comes to using using a linux terminal.
Tmux is a terminal multiplexer, it allows a user to access multiple terminals (or windows), each running a separate program, while providing a single screen to work on. Tmux is useful for running more than one command-line program at the same time, increasing productivity and the way you work.
Let's say you have already created one or more tmux sessions, and you have exited from it. So, basically you are in your default command prompt or shell (ex- Bash or Zsh). We will discuss how you can list all tmux sessions
List Tmux Sessions
Let's consider the case where you will have created multiple sessions.
tmux new -s dev-session
Ctrl b, d # Detach from session
tmux new -s prod-session
Ctrl b, d Detach from session
To list all active tmux sessions, you can run the command -
tmux list-sessions
A shortcut for the list-sessions
is ls
tmux ls
You can also format the output of the tmux ls
to display just the names of the sessions by adding a format flag with session_name
-
tmux ls -F "#{session_name}"
Once you list the sessions, you can attach to them to resume work and also detach or switch between them as per your convenience.
I hope you found this article useful, glad that you found it easy to list all active sessions in Tmux. You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.