Skip to content

Instantly share code, notes, and snippets.

@mihaiparaschiv
Last active March 21, 2020 01:12
Show Gist options
  • Save mihaiparaschiv/7a970a51ea481696368e81f36e6646b9 to your computer and use it in GitHub Desktop.
Save mihaiparaschiv/7a970a51ea481696368e81f36e6646b9 to your computer and use it in GitHub Desktop.
Utility scripts to create a tmux session
tmux new-window -n analysis -c /d/work/example
cd /g/work/a-analytics
tmux select-window -t analysis
tmux split-window -v -p 80
tmux select-pane -t 0
tmux send-keys "cd run/analysis-local" C-m
tmux send-keys "ls -la" C-m
tmux select-pane -t 1
tmux send-keys "ls -la" C-m
tmux split-window -h
tmux select-pane -t 0
tmux select-window -t analysis
tmux kill-window -t 0
set -e
TMUX_SESSION="$1"
if tmux list-sessions | grep -q ${TMUX_SESSION}; then
echo "${TMUX_SESSION} session already running"
tmux attach-session -t ${TMUX_SESSION}
else
tmux new -d -s ${TMUX_SESSION} -c /d/work
tmux send-keys -t ${TMUX_SESSION} "source setup-tmux-${TMUX_SESSION}.sh" C-m
tmux attach-session -t ${TMUX_SESSION}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment