TMUX Rocks!

9,530 views
9,405 views

Published on

TMUX Rocks!
tmux vs. GNU screen
Trick and tips sharing
Some extremely useful lightning fast handy key binding sharing :)

Published in: Technology
6 Comments
44 Likes
Statistics
Notes
No Downloads
Views
Total views
9,530
On SlideShare
0
From Embeds
0
Number of Embeds
49
Actions
Shares
0
Downloads
90
Comments
6
Likes
44
Embeds 0
No embeds

No notes for slide

TMUX Rocks!

  1. 1. TMUX Rocks! ( Terminal MUltipleXer ) Kent Chen
  2. 2. Kent Chen (chenkaie) chenkaie@gmail.com http://chenkaie.blogspot.com @chenkaie on GitHub @chenkaie on SlideShare @chenkaie on LinkedIn @chenkaie on Twitter @+KentChenAtGoogle on Google+
  3. 3. 終端复用器 基本功 不談 Not a basic intro course of terminal multiplexer
  4. 4. GNU Screen vs. tmux Ref: https://www.google.com/trends/explore?q=gnu screen, tmux
  5. 5. 分享小弟 「跳槽」經驗 (驚) An experience sharing after “Jump ship”
  6. 6. Screen 用得好好的? GNU Screen works god damn well?
  7. 7. 為什麼要換 tmux Why switch to tmux?
  8. 8. 請各位客倌
 聽我娓娓道來 Now listen carefully
  9. 9. GNU screen 七宗罪 The SE7EN deadly sins
  10. 10. ! 罪宗一 The 1st deadly sin
  11. 11. Memory eating MONSTER Sort by MEM%
  12. 12. 100 windows in Screen 370 MB resident Ref: http://jon.endpoint.com/utosc-2012/screen-vs-tmux-faceoff.html
  13. 13. 100 windows in tmux 5 MB resident Ref: http://jon.endpoint.com/utosc-2012/screen-vs-tmux-faceoff.html
  14. 14. ! 罪宗二 The 2nd deadly sin
  15. 15. Split with 3 window happily
  16. 16. 來去猩巴克 當個 假文青真碼農
 Think about coding at Starbucks
  17. 17. 體驗文青生活 妹也走光 寫扣吧 $ screen -x Reattach to previous session
  18. 18. WTF… ? ?
  19. 19. Restore a session with splitted screen Ref: http://superuser.com/questions/69816/how-to-keepwindows-split-after-detaching-reattaching-gnu-screen
  20. 20. ! 罪宗三 The 3rd deadly sin
  21. 21. Not under active development A dead project… since 2008
  22. 22. ! 罪宗四 The 4th deadly sin
  23. 23. .
  24. 24. ..
  25. 25. ...
  26. 26. 掰不下去了 Cannot think of more deadly sin
  27. 27. 其實還不錯 請繼續支持 自由軟體 Screen is still pretty excellent Donate Free Software, thanks!
  28. 28. 究竟 tmux 有何過人之處 Why tmux rocks?
  29. 29. 極具彈性的 Session Window Pane 視窗管理 Flexible Session / Window / Pane window management
  30. 30. Screenshot Session Pane 1 Pane 2 Pane 3 Session Name Window Left status bar Right status bar
  31. 31. $ tmux info Client 1 Client 2 Client N …… Session Window 1 Pane Window 2 Pane Pane … Window N Pane
  32. 32. $ tmux choose-session Client Session 2 Session 1 Window 1 Window 1 Pane Pane Window 2 Pane Pane Session 3 … Window N Window 1 Pane Pane
  33. 33. client / server model Ref: http://bit.ly/tmux-explained
  34. 34. 還有什麼 特異功能 Any tricks tips?
  35. 35. ! 第靈招 Tip Trick 0
  36. 36. No transfer effort from Screen 無痛轉換 i.e. 靈的轉移 (驚) Soul Transfer by: $ alias screen=tmux My modification: Ref: http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/examples/screen-keys.conf
  37. 37. ! 第一招 Tip Trick 1
  38. 38. Multiple paste buffers $ tmux list-buffers C-b # ! $ tmux paste-buffer C-b ]
  39. 39. ! 第二招 Tip Trick 2
  40. 40. Powerful mouse mode support Resize Pane Select Pane[1] Select Window 1. screen can do “select pane” only
  41. 41. ! 第三招 Tip Trick 3
  42. 42. Vertical splitting w/o patching You can patch GNU Screen to do it It’s pretty useful under 16:9 widescreen
  43. 43. ! 第四招 Tip Trick 4
  44. 44. Shared Sessions Multiple root-privileged system administrators can share the same session to manage the server. remote SSH w/o leaking your “password” Remote debugging Pair Programming
  45. 45. Pair Programming wemux: Multi-User Tmux Made Easy Mode: mirror / pair / rogue
  46. 46. No Magic Ref: http://bit.ly/tmux-explained
  47. 47. ! 第五招 Tip Trick 5
  48. 48. Search in windows $ tmux find-window C-b f
  49. 49. ! 第六招 Tip Trick 6
  50. 50. Powerline support https://github.com/erikw/tmux-powerline • Personal bias … XD • UTF-8 status line support
  51. 51. ! 第七招 Tip Trick 7
  52. 52. Synchronize panes C-b : :set synchronize-panes on
  53. 53. ! 第八招 Tip Trick 8
  54. 54. Highly Scriptable $ tmux list-commands $ tmux list-keys Ref: https://gist.github.com/lance/7486428
  55. 55. ! 第九招 Tip Trick 9
  56. 56. handy tmux_backup.sh Snapshot : Ref: http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/examples/tmux_backup.sh
  57. 57. ! 第十招 Tip Trick 10
  58. 58. PuTTy Fn key issue Terminal Keyboard Function Keys and Keypad: “Xterm R6”
  59. 59. ! 第十一招 Tip Trick 11
  60. 60. Scrollback issue * How can I make tmux use my terminal's scrollback buffer? ! Normally, tmux enables the terminal's alternate screen. Most terminals (such as xterm) do not save scrollback for the alternate screen.You might prefer tmux to use the normal screen, so it uses your terminal's scrollback buffer. This way, you can access the scrollback buffer as usual, for example using the mouse wheel - although there is no guarantee output inside tmux will always (or ever) be added to the scrollback. ! You can make tmux use the normal screen by telling it that your terminal does not have an alternate screen. Put the following in ~/.tmux.conf: ! set -g terminal-overrides 'xterm*:smcup@:rmcup@' Ref: tmux FAQ http://tmux.svn.sourceforge.net/viewvc/tmux/trunk/FAQ
  61. 61. ! 第十二招 Tip Trick 12
  62. 62. Lightening fast key binding “-n” #  Add  in  .tmux.conf   ! #  Lightning  fast  pane  movement  w/o  prefix  key  by  Alt-­‐`   bind  -­‐n  M-­‐`  select-­‐pane  -­‐t:.+   ! #  Lightning  fast  pane  resize  w/o  mouse  mode  by  Alt-­‐ArrowKey   bind  -­‐n  M-­‐up        resize-­‐pane  -­‐U  1   bind  -­‐n  M-­‐down    resize-­‐pane  -­‐D  1   bind  -­‐n  M-­‐left    resize-­‐pane  -­‐L  1   bind  -­‐n  M-­‐right  resize-­‐pane  -­‐R  1  
  63. 63. ! 第十三招 Tip Trick 13
  64. 64. Lightening fast key binding (cont.) #  Add  in  .tmux.conf   ! #  Lightning  fast  entering  copy-­‐mode  by  Alt-­‐c   #  Extremely  useful  when  split-­‐pane  are  heavily  used.   bind  -­‐n  M-­‐c  copy-­‐mode   bind  -­‐n  M-­‐PPage  copy-­‐mode  -­‐u   bind  -­‐n  S-­‐PPage  copy-­‐mode  -­‐u   ! #  Lightning  fast  window  select  by  Alt-­‐H  /  Alt-­‐L   bind  -­‐n  M-­‐H  prev   bind  -­‐n  M-­‐L  next   Entering copy-mode Search keyword in scrollback buffer
  65. 65. Reference Tmux @ Arch Linux wiki https://wiki.archlinux.org/index.php/Tmux Screen vs. tmux Faceoff http://jon.endpoint.com/utosc-2012/screen-vs-tmux-faceoff.html Fixing Vim's Background Color Erase for 256-color tmux http://sunaku.github.io/vim-256color-bce.html How to Copy and Paste with tmux on Mac OS X http://robots.thoughtbot.com/how-to-copy-and-paste-withtmux-on-mac-os-x
  66. 66. Reference cont. wemux: Multi-User Tmux Made Easy https://github.com/zolrath/wemux tmux-powerline https://github.com/erikw/tmux-powerline tmux FAQ http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/FAQ My .tmux.conf https://github.com/chenkaie/DotFiles/blob/master/.tmux.conf

×