Skip to content

Instantly share code, notes, and snippets.

@jenrzzz
Created May 15, 2013 23:19
Show Gist options
  • Select an option

  • Save jenrzzz/5588205 to your computer and use it in GitHub Desktop.

Select an option

Save jenrzzz/5588205 to your computer and use it in GitHub Desktop.
tmux session switcher function
function sesh() {
if [[ $# -gt 0 ]]; then
case "$1" in
new)
tmux new -s "$2"
;;
*)
if tmux list-sessions | grep "attached"; then
tmux switch -t "$1"
else
tmux attach -t "$1"
fi
;;
esac
else
(tmux list-sessions &>/dev/null && tmux list-sessions) || echo "No active sessions."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment