tmux tricks - Serbipunk/notes GitHub Wiki

change default dir

Ctrl+b :

attach -c /ddd/eee

kill all sessions

pkill -f tmux

tmux kill-session -a

https://askubuntu.com/questions/868186/how-to-kill-all-tmux-sessions-or-at-least-multiple-sessions-from-the-cli

sz

no solution

https://v2ex.com/t/379440

resize when other session opened

set-window-option -g aggressive-resize on

enable mouse

https://stackoverflow.com/questions/7798103/how-to-enable-scrolling-in-tmux-panels-with-mouse-wheel

set -g mouse on

:setw -g mouse

setw -g mouse off

mouse selection

https://superuser.com/questions/505737/tmux-any-way-to-enable-scrolling-but-not-selection

mouse mode copy: shift

https://blog.jasonmeridth.com/posts/copying-text-with-mouse-in-tmux/

rename

ctrl + b, $

https://superuser.com/questions/428016/how-do-i-rename-a-session-in-tmux

tmux setup and launch shell

https://stackoverflow.com/a/40009032

tmux new-session \; \
  send-keys 'tail -f /var/log/monitor.log' C-m \; \
  split-window -v \; \
  split-window -h \; \
  send-keys 'top' C-m \; 

create and detach

tmux new-session -d -s monitor "cd /tmp && watch nvidia-smi";

https://stackoverflow.com/a/31903189

with sudo

tmux new-session -d -s monitor "cd /tmp && echo 000123 | sudo -S watch nvidia-smi"