Skip to content

Instantly share code, notes, and snippets.

@mousavian
Created March 15, 2016 02:28
Show Gist options
  • Save mousavian/a1929f65ea3c07fded3e to your computer and use it in GitHub Desktop.
Save mousavian/a1929f65ea3c07fded3e to your computer and use it in GitHub Desktop.
Simple script to automate session/window & pane creation for tmux
#!/bin/bash
sn=GuGu
# Start the session and window 0 in workplace
# This will also be the default cwd for new windows created
# via a binding unless overridden with default-path.
cd /home/workspace
tmux new-session -s "$sn" -n "FirstWindowName" -d
tmux split-window -v
tmux split-window -h
# Create a bunch of windows
for i in {2..2}; do
tmux new-window -t "$sn:$i" -n "WindowName:$i" #'sudo su'
tmux split-window -v
tmux split-window -h
done
# Set the default cwd for new windows (optional, otherwise defaults to session cwd)
# tmux set-option default-path /
# Select window #1 and attach to the session
tmux select-window -t "$sn:1"
tmux -2 attach-session -t "$sn"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment