SlideShare una empresa de Scribd logo
1 de 67
Descargar para leer sin conexión
TMUX Rocks!	

( Terminal MUltipleXer )
Kent Chen
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+
終端复用器
基本功

不談
Not a basic intro course of	

terminal multiplexer
GNU Screen vs. tmux

Ref: https://www.google.com/trends/explore?q=gnu screen, tmux
分享小弟
「跳槽」經驗
(驚)

An experience sharing after “Jump ship”
Screen	

用得好好的?
GNU Screen works god damn well?
為什麼要換
tmux
Why switch to tmux?
請各位客倌

聽我娓娓道來
Now listen carefully
GNU screen	

七宗罪
The SE7EN deadly sins
!

罪宗一
The 1st deadly sin
Memory eating MONSTER
Sort by MEM%
100 windows in 	

Screen	

370 MB resident
Ref: http://jon.endpoint.com/utosc-2012/screen-vs-tmux-faceoff.html
100 windows in 	

tmux	

5 MB resident
Ref: http://jon.endpoint.com/utosc-2012/screen-vs-tmux-faceoff.html
!

罪宗二
The 2nd deadly sin
Split with 3 window happily
來去猩巴克

當個

假文青真碼農

Think about coding at Starbucks
體驗文青生活

妹也走光

寫扣吧

	


$ screen -x	


Reattach to previous session
WTF…

?
?
Restore a session with splitted screen

Ref: http://superuser.com/questions/69816/how-to-keepwindows-split-after-detaching-reattaching-gnu-screen
!

罪宗三
The 3rd deadly sin
Not under active development

A dead project… 	

since 2008
!

罪宗四
The 4th deadly sin
.
..
...
掰不下去了
Cannot think of more deadly sin
其實還不錯

請繼續支持

自由軟體
Screen is still pretty excellent	

Donate Free Software, thanks!
究竟

tmux	

有何過人之處
Why tmux rocks?
極具彈性的

Session  Window  Pane	


視窗管理
Flexible Session / Window / Pane
window management
Screenshot

Session

Pane 1

Pane 2

Pane 3
Session Name

Window
Left status bar

Right status bar
$ tmux info
Client 1

Client 2

Client N

……
Session
Window 1

Pane

Window 2

Pane

Pane

…

Window N

Pane
$ 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
client / server model

Ref: http://bit.ly/tmux-explained
還有什麼

特異功能
Any tricks  tips?
!

第靈招
Tip  Trick 0
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
!

第一招
Tip  Trick 1
Multiple paste buffers
$ tmux list-buffers	

C-b #	

!

$ tmux paste-buffer	

C-b ]
!

第二招
Tip  Trick 2
Powerful mouse mode support
Resize Pane	

Select Pane[1]	

Select Window	

1. screen can do “select pane” only
!

第三招
Tip  Trick 3
Vertical splitting w/o patching
You can patch GNU
Screen to do it

It’s pretty useful under
16:9 widescreen
!

第四招
Tip  Trick 4
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
Pair Programming
wemux: Multi-User Tmux Made Easy	

Mode: mirror / pair / rogue
No Magic

Ref: http://bit.ly/tmux-explained
!

第五招
Tip  Trick 5
Search in windows
$ tmux find-window	

C-b f
!

第六招
Tip  Trick 6
Powerline support
https://github.com/erikw/tmux-powerline
•

Personal bias … XD	


•

UTF-8 status line support
!

第七招
Tip  Trick 7
Synchronize panes
C-b : 	

:set synchronize-panes on
!

第八招
Tip  Trick 8
Highly Scriptable
$ tmux list-commands	

$ tmux list-keys

Ref: https://gist.github.com/lance/7486428
!

第九招
Tip  Trick 9
handy tmux_backup.sh
Snapshot :

Ref: http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/examples/tmux_backup.sh
!

第十招
Tip  Trick 10
PuTTy Fn key issue
Terminal  Keyboard  Function Keys and Keypad: “Xterm R6”
!

第十一招
Tip  Trick 11
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
!

第十二招
Tip  Trick 12
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  
!

第十三招
Tip  Trick 13
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
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
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

Más contenido relacionado

La actualidad más candente

The Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEPThe Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEP
Gregor Schmidt
 
tcpdumpとtcpreplayとtcprewriteと他。
tcpdumpとtcpreplayとtcprewriteと他。tcpdumpとtcpreplayとtcprewriteと他。
tcpdumpとtcpreplayとtcprewriteと他。
(^-^) togakushi
 

La actualidad más candente (20)

用十分鐘 向jserv學習作業系統設計
用十分鐘  向jserv學習作業系統設計用十分鐘  向jserv學習作業系統設計
用十分鐘 向jserv學習作業系統設計
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
Learn C Programming Language by Using GDB
Learn C Programming Language by Using GDBLearn C Programming Language by Using GDB
Learn C Programming Language by Using GDB
 
Virtual Machine Constructions for Dummies
Virtual Machine Constructions for DummiesVirtual Machine Constructions for Dummies
Virtual Machine Constructions for Dummies
 
The Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEPThe Microkernel Mach Under NeXTSTEP
The Microkernel Mach Under NeXTSTEP
 
[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical
 
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Worksfrom Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
 
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
LLVM 總是打開你的心:從電玩模擬器看編譯器應用實例
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
 
Embedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile DevicesEmbedded Virtualization applied in Mobile Devices
Embedded Virtualization applied in Mobile Devices
 
The Internals of "Hello World" Program
The Internals of "Hello World" ProgramThe Internals of "Hello World" Program
The Internals of "Hello World" Program
 
tcpdumpとtcpreplayとtcprewriteと他。
tcpdumpとtcpreplayとtcprewriteと他。tcpdumpとtcpreplayとtcprewriteと他。
tcpdumpとtcpreplayとtcprewriteと他。
 
tmux
tmuxtmux
tmux
 
Linux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old SecretsLinux Performance Analysis: New Tools and Old Secrets
Linux Performance Analysis: New Tools and Old Secrets
 
What Can Compilers Do for Us?
What Can Compilers Do for Us?What Can Compilers Do for Us?
What Can Compilers Do for Us?
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021
 
OCIランタイムの筆頭「runc」を俯瞰する
OCIランタイムの筆頭「runc」を俯瞰するOCIランタイムの筆頭「runc」を俯瞰する
OCIランタイムの筆頭「runc」を俯瞰する
 

Destacado

数式を使わないJubatus入門 分散処理編
数式を使わないJubatus入門 分散処理編数式を使わないJubatus入門 分散処理編
数式を使わないJubatus入門 分散処理編
Kenji Aiko
 

Destacado (11)

Tmux tips and_tricks
Tmux tips and_tricksTmux tips and_tricks
Tmux tips and_tricks
 
Introduction to Tmux - Codementor Tmux Office Hours Part 1
Introduction to Tmux - Codementor Tmux Office Hours Part 1Introduction to Tmux - Codementor Tmux Office Hours Part 1
Introduction to Tmux - Codementor Tmux Office Hours Part 1
 
How To Access Code In Large w/ Vim
How To Access Code In Large w/ VimHow To Access Code In Large w/ Vim
How To Access Code In Large w/ Vim
 
Dettol Dish Washer
Dettol Dish WasherDettol Dish Washer
Dettol Dish Washer
 
Vim survival guide
Vim survival guideVim survival guide
Vim survival guide
 
Introduction to Vim
Introduction to VimIntroduction to Vim
Introduction to Vim
 
Real programmers use programming languages (Not shell scripts)
Real programmers use programming languages (Not shell scripts)Real programmers use programming languages (Not shell scripts)
Real programmers use programming languages (Not shell scripts)
 
Vim Hacks
Vim HacksVim Hacks
Vim Hacks
 
Vimbar
VimbarVimbar
Vimbar
 
数式を使わないJubatus入門 分散処理編
数式を使わないJubatus入門 分散処理編数式を使わないJubatus入門 分散処理編
数式を使わないJubatus入門 分散処理編
 
Introduction to Vim 8.0
Introduction to Vim 8.0Introduction to Vim 8.0
Introduction to Vim 8.0
 

Similar a TMUX Rocks!

Chroma key-in-windows-movie-maker
Chroma key-in-windows-movie-makerChroma key-in-windows-movie-maker
Chroma key-in-windows-movie-maker
Daniel Downs
 
44CON 2014 - Switches Get Stitches, Eireann Leverett & Matt Erasmus
44CON 2014 - Switches Get Stitches,  Eireann Leverett & Matt Erasmus44CON 2014 - Switches Get Stitches,  Eireann Leverett & Matt Erasmus
44CON 2014 - Switches Get Stitches, Eireann Leverett & Matt Erasmus
44CON
 
Uses of tmux explained
Uses of tmux explainedUses of tmux explained
Uses of tmux explained
Stanislas Polu
 

Similar a TMUX Rocks! (20)

tmux - An overview of the features of this powerful terminal multiplexer.
tmux - An overview of the features of this powerful terminal multiplexer.tmux - An overview of the features of this powerful terminal multiplexer.
tmux - An overview of the features of this powerful terminal multiplexer.
 
screen and tmux
screen and tmuxscreen and tmux
screen and tmux
 
Improving your shell usage - 2009
Improving your shell usage - 2009Improving your shell usage - 2009
Improving your shell usage - 2009
 
Tmux and Tmuxinator ~ Rise of the Machines
Tmux and Tmuxinator  ~ Rise of the MachinesTmux and Tmuxinator  ~ Rise of the Machines
Tmux and Tmuxinator ~ Rise of the Machines
 
Tmux quick intro
Tmux quick introTmux quick intro
Tmux quick intro
 
Small Screen Development
Small Screen DevelopmentSmall Screen Development
Small Screen Development
 
Pairing with tmux and vim for DevOps Days Austin 2015
Pairing with tmux and vim for DevOps Days Austin 2015Pairing with tmux and vim for DevOps Days Austin 2015
Pairing with tmux and vim for DevOps Days Austin 2015
 
Linux Command Line Multitasking
Linux Command Line MultitaskingLinux Command Line Multitasking
Linux Command Line Multitasking
 
Chroma key-in-windows-movie-maker
Chroma key-in-windows-movie-makerChroma key-in-windows-movie-maker
Chroma key-in-windows-movie-maker
 
44CON 2014 - Switches Get Stitches, Eireann Leverett & Matt Erasmus
44CON 2014 - Switches Get Stitches,  Eireann Leverett & Matt Erasmus44CON 2014 - Switches Get Stitches,  Eireann Leverett & Matt Erasmus
44CON 2014 - Switches Get Stitches, Eireann Leverett & Matt Erasmus
 
Machinima --How To in Second Life
Machinima --How To in Second LifeMachinima --How To in Second Life
Machinima --How To in Second Life
 
Tmux Development Workflow
Tmux Development WorkflowTmux Development Workflow
Tmux Development Workflow
 
2016 nov-16 grenoble-floss_tmux
2016 nov-16 grenoble-floss_tmux2016 nov-16 grenoble-floss_tmux
2016 nov-16 grenoble-floss_tmux
 
Kodar-lan - Text and editors Vi/Vim
Kodar-lan - Text and editors Vi/VimKodar-lan - Text and editors Vi/Vim
Kodar-lan - Text and editors Vi/Vim
 
Using the cisco console in linux
Using the cisco console in linux Using the cisco console in linux
Using the cisco console in linux
 
tmux عدنان الشعلة شرح برنامج
tmux عدنان الشعلة شرح برنامج tmux عدنان الشعلة شرح برنامج
tmux عدنان الشعلة شرح برنامج
 
Ultimate Unix Meetup Presentation
Ultimate Unix Meetup PresentationUltimate Unix Meetup Presentation
Ultimate Unix Meetup Presentation
 
Ci For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or GalCi For The Web 2.0 Guy Or Gal
Ci For The Web 2.0 Guy Or Gal
 
21 command prompt tricks and hacks
21 command prompt tricks and hacks21 command prompt tricks and hacks
21 command prompt tricks and hacks
 
Uses of tmux explained
Uses of tmux explainedUses of tmux explained
Uses of tmux explained
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

TMUX Rocks!