[tmux] Automate your workflow using tmux scripts

Do you have a standard workflow that involves setting up a specific tmux layout, or running certain commands? By writing tmux scripts, you can automate your tedious daily setup, while simultaneously documenting it for yourself. We'll cover the tmux command equivalents of common key bindings and write some simple, useful scripts.

# Set some configuration options
SESSION=$USER

# Create a new, detached session
tmux new-session -d -s $SESSION

# Create a second window
tmux new-window -t $SESSION:1 -n 'webserver'

# Select and configure the first window
tmux select-window -t $SESSION:1
tmux split-window -v 
tmux send-keys 'cd examples/react; python -m SimpleHTTPServer' C-m

# Attach to the session
tmux attach-session -t $SESSION
原文地址:https://www.cnblogs.com/Answer1215/p/6735020.html