Skip to content

Instantly share code, notes, and snippets.

@huntie
Created November 28, 2020 16:31
Show Gist options
  • Save huntie/2a851708285299750dec4411ab835d63 to your computer and use it in GitHub Desktop.
Save huntie/2a851708285299750dec4411ab835d63 to your computer and use it in GitHub Desktop.
Start a tmux server if none exists, create a new session if tmux is in use, or reattach if no tmux sessions are connected - and exit after. Useful as the initial command for a terminal profile.
tmux ls | grep attached > /dev/null && tmux || tmux attach || tmux; exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment