tmux
#ToResearch #Knowledge #coding
tmux perserves a terminal session, making it useful when remotely accessing machines, especially with sessions that might drop
Concepts:
session
pane like a window
window like a tab
buffer like a clipboard(?)
Commands:
tmux new [-s $title] // create new session
tmux a [-t $title] // attach this terminal to session
tmux list-sessions // show active sessions w/ details
tmux Internal Commands:
ctrl b // tmux command mode {prefix}
ctrl b + $ // rename active session
ctrl b + , // command mode, rename active window
ctrl b + : // command mode, labeled command
https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/tmux.md
Workflows
Save terminal output to file
ctrl b + :+ // command mode, labeled commandcapture-pane [-S -100]capture the pane's (last 100 lines) output to a bufferctrl b + :+ // command mode, labeled commandsave-buffer [output-file.txt]
Use Windows
ctrl b + c// create window (new tab)ctrl b + n// next tabctrl b + ,// rename tabctrl b + &// close tab
Use Panes
ctrl b + "split pane along x axis (a top and bottom)ctrl b + %split pane along y axis (left & right)ctrl b + {go left a panectrl b + }go right a pane
copy mode
ctrl-benter command modecopy modeis the mode to search the bufferctrl-senters search prompt to enter the stringentersearches the termn= 'next',shift - n= reverse 'next' (back)escapetwice to exit copy mode