tmuxref.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # tmux reference
  2. https://wiki.archlinux.org/title/Tmux
  3. https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
  4. https://www.seanh.cc/2020/12/28/binding-keys-in-tmux/
  5. https://www.seanh.cc/2020/12/28/setting-options-in-tmux/
  6. bind is the alias of bind-key
  7. set is the alias of set-option
  8. setw is the alias of set-window-option
  9. To list all current key bindings, including any custom bindings you've added and
  10. bindings added by plugins:
  11. * ctrl + a ?
  12. * tmux list-keys or tmux lsk in a shell inside tmux
  13. * list-keys or lsk at tmux's command prompt (ctrl + a :)
  14. # display current tmux configuration
  15. tmux show-options -g | grep status
  16. # assign ctrl + a as prefix key
  17. ctrl + a and ctrl + ---> # resize pane
  18. ctrl + a and z # full screen/no full screen
  19. tmux # start tmux
  20. tmux new -s < name > # start tmux with
  21. tmux ls/list-sessions # list-sessions currently running on tmux
  22. tmux attach -t n # attach session number n (-t = target session)
  23. tmux list-windows -a # list-sessions when running inside another tmux
  24. tmux move-window -s n1 -t n2 # -s (source window), (-t target window)
  25. # Example: (sessionNo:windowNo) # n1 (number of the window you want to move)
  26. tmux move-window -s 0:3 -t 1:4 # n2 (number of the window you are moving to)
  27. ctrl + a and d # detach the current client
  28. ctrl + a and D # choose a client to detach
  29. tmux kill-session # kill-session (default: when only one session)
  30. tmux kill-session -t n # kill-session number n (-t = target session)
  31. tmux kill-server # kill all session
  32. # moving a pane
  33. tmux list-panes -a # list-panes
  34. tmux list-panes -t 0:1 # list-panes in sessionNo = 0 and windowNo = 1
  35. # display current running commands at each pane:
  36. tmux list-panes -F "#{pane_current_command}" -t 0:1
  37. ctrl-s # search
  38. ctrl-a and q # show number
  39. Alt + Enter # create new window
  40. Alt + a # toggle windows
  41. Alt + n # next window
  42. Alt + p # previous window
  43. # help
  44. ctrl-a and ? # show the list of commands
  45. # reload
  46. ctrl-a and r # reload tmux.conf file
  47. # sessions
  48. ctrl-a and s # list sessions
  49. ctrl-a and $ # rename sessions
  50. ctrl-a and d # detach session
  51. # windows
  52. ctrl-d can be used to close the window or panes without ctrl-a
  53. ctrl-a and w # list windows and select one
  54. ctrl-a and , # rename window
  55. ctrl-a and c # create new window
  56. ctrl-a and n # next window
  57. ctrl-a and p # previous window
  58. ctrl-a and f # find window
  59. ctrl-a and & # kill window
  60. ctrl-a and 0-9 # select window 0-9
  61. # panes (split windows)
  62. ctrl-a and - # vertical split
  63. ctrl-a and = # horizontal split
  64. ctrl-a and x # kill pane
  65. ctrl-a and o # next pane
  66. ctrl-a and h,j,k,l # vi-like keybindings
  67. ctrl-a and z # toggle full-screen mode for current pane
  68. ctrl-a and arrow keys # resize the pane
  69. ctrl-a and q # show pane-numbers
  70. # commands
  71. ctrl-a and : # command mode
  72. then, type the commands as below,
  73. list-keys # shows all the commands
  74. list-panes # shows the names of all panes
  75. resize-pane-D 20 # resize down
  76. resize-pane-U 20 # resize up
  77. resize-pane-L 20 # resize left
  78. swap-pane -s 3 -t 1 # swap pane '1' with pane '3'
  79. # copy mode
  80. Esc # copy mode
  81. then, use the following commands without using 'ctrl-a'
  82. q # quit mode
  83. h,j,k,l # left, down, up, right
  84. J or k # scroll down or up
  85. F or B # go to next or previous page
  86. $ # go to end of line
  87. O # go to beginning of line
  88. w or b # go to next or previous word
  89. / or ? # search forward or backward
  90. n # search next (use after above commands)
  91. space # start selection
  92. Esc # clear selection
  93. y # copy selection
  94. ctrl-a and p # paste selection