Skip to content

Instantly share code, notes, and snippets.

@lirenlin
Last active November 4, 2020 17:41
Show Gist options
  • Select an option

  • Save lirenlin/9145493 to your computer and use it in GitHub Desktop.

Select an option

Save lirenlin/9145493 to your computer and use it in GitHub Desktop.
tmux init script
#!/bin/bash
# var for session name (to avoid repeated occurences)
sn=home
# Start the session and window 0 in /etc
# This will also be the default cwd for new windows created
# via a binding unless overridden with default-path.
cd /etc
tmux new-session -s "$sn" -n etc -d
# Create a bunch of windows in /var/log
cd /var/log
for i in {1..3}; do
tmux new-window -t "$sn:$i" -n "var$i"
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"
@eabase
Copy link
Copy Markdown

eabase commented Nov 4, 2020

Nice one. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment