tmux/Q/How can I refresh .zshrc in all of my open panes and windows in tmux?
Properties
- tags
- Diataxis/How To
How can I refresh
.zshrcin all of my open panes and windows in tmux?My Notes
Answer
- AI/Response
- Use
tmux send-keysto broadcast asource ~/.zshrccommand to every pane across all sessions: - bash
tmux list-panes -a -F '#{pane_id}' | xargs -I{} tmux send-keys -t {} 'source ~/.zshrc' Enter - Alternatively, using a shell loop for more visibility:
- bash
for pane in $(tmux list-panes -a -F '#S:#I.#P'); do tmux send-keys -t "$pane" 'source ~/.zshrc' Enter done - Caveats
- This sends keystrokes into whatever is currently running in each pane — if a pane has a long-running process active, the keystrokes will be buffered or misinterpreted
- Panes running something other than a shell prompt (e.g.
vim,python) will receive the literal textsource ~/.zshrc— interrupt/exit those first if needed - New panes opened after running this will automatically source the updated
.zshrcsince they start fresh shells
- tmux send-keys docs
- Use
- AI/Response