Sometime I do have a couple of sessions already running, I didn't name them or I use random name.
Currently I have to ctrl-a
and s
or :list-sessions
in order to list all sessions and switch to them.
When I started a new tmux via tmux
command. How can I automatically list existing sessions?
I have a shell function (for Bash) for this. When I run tmux
without any options and there are already some sessions it'll prompt for me to choose one.
function _tmux()
{
if [[ $# == 0 ]] && command tmux ls >& /dev/null; then
command tmux attach \; choose-tree -s
else
command tmux "$@"
fi
}
alias tmux=_tmux