Last active
November 4, 2020 17:41
-
-
Save lirenlin/9145493 to your computer and use it in GitHub Desktop.
tmux init script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice one. Thanks.