Skip to content

Instantly share code, notes, and snippets.

@ryankanno
Created February 27, 2014 04:06
Show Gist options
  • Save ryankanno/9244195 to your computer and use it in GitHub Desktop.
Save ryankanno/9244195 to your computer and use it in GitHub Desktop.
Tmux helper to list tmux sessions, attach to an existing session, or create a brand new one!
function tm() {
if [ -n "$1" ]; then
tmux attach -t $1 2>/dev/null || tmux new -s $1
else
tmux list-sessions 2> >(grep -q 'failed')
if [ "$?" -eq 1 ]; then
echo "No available tmux sessions. Please create one."
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment