ã¯ããã«
ããã«ã¡ã¯ïŒITã¹ã¯ãŒã«RareTECHã«ãŠCSïŒCustomer SupportïŒãæ
åœããŠããæ± æã§ããä»åã®èšäºã¯ã·ã§ã«ãæ±ã人ãªãå
¥ããŠãããŠã»ããtmuxãšããããŒã«ã«ã€ããŠã§ãã
tmuxã¯ç°¡åã«è¡ã£ãŠããŸããšãã¿ãŒããã«ã®ç»é¢ãåå²ããŠããã䟿å©ãªããŒã«ã§ãã
åºæ¬çã«ã¯MacãšLinuxåãã®èšäºã§ãããWindowsã®æ¹ã¯WSLãªã©ãå ¥ããŠãå©çšãã ãããããçšåºŠã®Linuxã³ãã³ãã«æ £ãã人åãã§ãã
tmuxã®æŠèŠ
tmuxã®æ£åŒå称ã¯Terminal MultiplexerïŒã¿ãŒããã«ãã«ããã¬ã¯ãµïŒã§ãã
Linuxç³»åã®ã¿ãŒããã«ç»é¢ããã»ãã·ã§ã³ããŠã£ã³ããŠããã€ã³ãšããæŠå¿µã䜿ã£ãŠåãåããŠæ±ãããšãã§ããŸãã
ãã ãã®tmuxã䜿ãããªãã®ã«è¥å¹²ã®æéãããããŸãã
ã§ããã䜿ãããªããšã·ã§ã«ã®æäœæãã¬ã©ãªãšå€ãããŸãã
ã¿ãŒããã«->ã»ãã·ã§ã³->ãŠã£ã³ããŠ->ãã€ã³ã®é ã§åãåãããããã®ã§ãã
ã€ã³ã¹ããŒã«ãšèµ·åã«ã€ããŠ
Macã®å Žå
brew install tmux
â»Homebrewãå ¥ã£ãŠããåæã§ããå ¥ã£ãŠããªãæ¹ã¯ä»¥äžã®ãªã³ã¯ããã€ã³ã¹ããŒã«ãé¡ãããŸãã
ã€ã³ã¹ããŒã«ãçµãã£ããããŒãžã§ã³ã確èªããŸãããã
tmux -V
# åºåçµæïŒäŸïŒ
tmux 3.5a
tmuxãèµ·åããŠã¿ããã
tmux
äžèšãã¿ãŒããã«äžã§å©ããšãtmuxãèµ·åããŠæ°ããã·ã§ã«ç»é¢ãåºãŠããã¯ãã§ãã
tmuxãéãã
exit
èµ·åãšåºãæ¹æ³ã¯å šç¶é£ãããªãã§ããã
ãã¬ãã£ãã¯ã¹ã«ã€ããŠ
tmuxã«ã¯ãã¬ãã£ãã¯ã¹ãšããæŠå¿µããããŸããtmuxãæäœãããšãã«ãæäœããŸããããšããã®ãã·ã§ã«ã«äŒããããã®ã³ãã³ãã®ãããªãã®ã§ãã
tmuxã¯ãã¬ãã£ãã¯ã¹ + ããŒãã€ã³ãã§è²ã ãªæäœãããŸãã
tmuxãå ¥ããåæã¯control + bããã¬ãã£ãã¯ã¹ã«ãªã£ãŠããŸãã
泚æç¹ãšããŠããã¬ãã£ãã¯ã¹ãããŒããŒãã§æã£ãåŸãäžåºŠããŒããŒãããæãé¢ããŠãã次ã®ã³ãã³ããæã¡ãŸããå°ãæ
£ããå¿
èŠã§ãã
controlãæŒããªããbãæŒã -> æãé¢ã -> 次ã®ã³ãã³ããæã€
ãšããæµãã§ãã
ç»é¢ãåå²ãããŠã¿ãã
# controlãæŒããªããbãæŒã -> æãé¢ã -> "ãæŒã
control + b -> "
ç»é¢ã瞊åå²ã§ããŠãããæåã§ãã
次ã¯æšªåå²ãããŠã¿ãŸãããã
# controlãæŒããªããbãæŒã -> æãé¢ã -> %ãæŒã
control + b -> %
ãããªç»é¢ã«ãªã£ãŠãããæåã§ãã
exitã§çµäºããŸããããïŒ3ã€åãªã®ã§3åæã£ãŠãã ããïŒ
ã»ãã·ã§ã³ããŠã£ã³ããŠããã€ã³ã«ã€ããŠ
ããããã¯tmuxã®æŠå¿µã§ããã»ãã·ã§ã³ã»ãŠã£ã³ããŠã»ãã€ã³ã«ã€ããŠèª¬æããŠãããŸãã
ã»ãã·ã§ã³
ãŸãã¿ãŒããã«ããã»ãã·ã§ã³ãèµ·åããŸãã
ããã¯å
ã»ã©ãã£ãéã
tmux
ã§èµ·åãå®äºããŸããã§ã¯ã»ãã·ã§ã³åšãã確èªããããã«ä»¥äžã®æé ã§ã³ãã³ããå©ããŠã¿ãŸãããã
â ã»ãã·ã§ã³ã«ååãã€ããŠèµ·åãã
tmux new -s Default
â»ä»åã¯Defaultãšããã»ãã·ã§ã³ãèµ·åããŠããŸãã
tmuxã®ã»ãã·ã§ã³ãèµ·åãããšæããŸãã
â¡ã»ãã·ã§ã³ãäžæããŠã¡ã€ã³ã®ã¿ãŒããã«ã«æ»ã
# controlãæŒããªããbãæŒã -> æãé¢ã -> dãæŒã
control + b -> d
ããã§ã¡ã€ã³ã®ã¿ãŒããã«ã«æ»ã£ããšæããŸãã
ããã§ã¯äžæçã«äžæããŠããã ããªã®ã§ãå ¥ãçŽãããšãã§ããŸãã
â¢Defaultã®ã»ãã·ã§ã³ãéãçŽã
tmux a
ããã§å ã»ã©ãŸã§èµ·åããŠããDefaultãšåä»ããã»ãã·ã§ã³ãåéããŸããã
â£å床åºãŠãæ°ããã»ãã·ã§ã³ãäœæ
tmux new -s Normal
â€ã»ãã·ã§ã³ã®äžèŠ§ã確èªããŠã¿ã
ããã¯ããã€ãããæ¹ãããã®ã§ããããŸãã¡ã€ã³ã®ã¿ãŒããã«ãšã»ãã·ã§ã³äžã©ã¡ãã§ã確èªãã§ããæ¹æ³ããããŸãã
tmux list-sessions
ããäžã€ç¢ºèªããæ¹æ³ããã¬ãã£ãã¯ã¹ã䜿ãæ¹æ³ã§ãã
# controlãæŒããªããbãæŒã -> æãé¢ã -> sãæŒã
control + b -> s
ãã ããã®åŸçŽ¹ä»ãããŠã£ã³ããŠã確èªããæ¹æ³ã®æã«ã»ãã·ã§ã³ã®äžèŠ§ã衚瀺ãããã®ã§ãããŸã䜿ããªããšæã£ãŠããã£ãŠå€§äžå€«ã§ãã
ãã ãtmuxã®ã»ãã·ã§ã³ã䜿ã£ãŠããªãç¶æ
ã§ã確èªãã§ããtmux list-sessions
ã®æ¹ã¯ããŸã«äœ¿ããŸãã
以äžã®ããã«ãªã£ãŠãããæ£ããã»ãã·ã§ã³éå§ãããŠããŸãã
ä»ã¯DefaultãšNormalã®äºã€ã®ã»ãã·ã§ã³ãããããšããããšã§ããã
ã§ãããã§attachedãšæžãããŠããéšåããçŸåšããã»ãã·ã§ã³ã®ããšã§ãã
ã¢ã¿ãããããïŒæ¥ç¶ãããïŒããã¿ãããããïŒæ¥ç¶ãåãé¢ãããïŒãšããèšèãtmuxã§ã¯äœ¿ãããŸãã
tmux a
# controlãæŒããªããbãæŒã -> æãé¢ã -> dãæŒã
control + b -> d
ãŠã£ã³ããŠ
次ã«ãŠã£ã³ããŠã«ã€ããŠè§£èª¬ããŸãã
ãŸã倧åæãšããŠãäžã€ã®ã»ãã·ã§ã³ã®äžã«ã¯å¿
ãäžã€ä»¥äžã®ãŠã£ã³ããŠããããŸãã
ãããŠãã»ãã·ã§ã³ã®äžã«ããããã®ãŠã£ã³ããŠãäœããŸãã
ãŠã£ã³ããŠã®æäœã¯ã»ãã·ã§ã³ãšã¯ãŸãå¥ã§ãã®ã§ãé çªã«ã¿ãŠãããŸãããã
â ãŠã£ã³ããŠãäœã£ãŠã¿ã
# controlãæŒããªããcãæŒã -> æãé¢ã -> cãæŒã
control + b -> c
æ°ãããŠã£ã³ããŠãäœãããã¯ãã§ãã
ã¡ãã£ãšãã®ãŸãŸã ãšãããã«ããã®ã§ããŠã£ã³ããŠã«ååãã€ããããšæããŸãã
â¡ãŠã£ã³ããŠã«ååãã€ãã
# controlãæŒããªããbãæŒã -> æãé¢ã -> ,ãæŒã
control + b -> ,
ãããå®è¡ãããšãååãå€æŽã§ããããã«ãªããŸãã
ã§ã¯zshãæ¶ããŠãä»åã¯Number2ãšããååãã€ããŠã¿ãŸãããã
â¢ãŠã£ã³ããŠäžèŠ§ã確èª
# controlãæŒããªããbãæŒã -> æãé¢ã -> wãæŒã
control + b -> w
以äžã®ãããªè¡šç€ºã«ãªã£ãŠãããªãæåã§ãã
Number2ãšãããŠã£ã³ããŠããããšæããŸãã
äžäžããŒã§ç§»åãå¯èœã§ããäžã€äžã®ãŠã£ã³ããŠã«ç§»åããŠã¿ãŸãããã
Vimã«æ £ããŠãã人ãªããj,kã§äžäžã«ç§»åå¯èœã§ãã
ãã¡ããååãå€ããŠãNumber1ã«ããŠã¿ãŠãã ããã
â£ãŠã£ã³ããŠéã®ç§»å
# controlãæŒããªããbãæŒã -> æãé¢ã -> n or pãæŒãïŒnã¯æ¬¡ãpã¯åã«ç§»åïŒ
control + b -> n or p
â€ãŠã£ã³ããŠãçµäºãã
çµäºæ¹æ³ã¯2ãã¿ãŒã³ãããŸããåŸè ã®æ¹ã¯ç¢ºèªã¡ãã»ãŒãžãåºãŠããã®ã§å®å šã§ãã
exit
or
# controlãæŒããªããbãæŒã -> æãé¢ã -> &ãæŒã
control + b -> &
ãã€ã³
次ã«ãã€ã³ã®è§£èª¬ãããããŸãã
ãã€ã³ã¯ãŠã£ã³ããŠã®äžã«ããã«çŽ°ããªã¿ãŒããã«ãäœãããã®ã§ããæåã«è¡ã£ãç»é¢åå²ã¯ããã€ã³ãäœã£ãŠãããšããããšã«ãªããŸãã
瞊ã«å²ãã暪ã«å²ãã¯è¡ã£ããšæããŸãã®ã§ãå床ãã£ãŠã¿ãŸãããã
# ïŒæšªåå²ïŒcontrolãæŒããªããbãæŒã -> æãé¢ã -> %ãæŒã
control + b -> %
# ïŒçžŠåå²ïŒcontrolãæŒããªããbãæŒã -> æãé¢ã -> "ãæŒã
control + b -> "
ã§ã¯ãã®ç¶æ ã§æ¬¡ã®æäœãé çªã«è¡ã£ãŠãããŸãããã
â ãã€ã³éã移åããŠã¿ã
# controlãæŒããªããbãæŒã -> æãé¢ã -> ååããŒãæŒã
control + b -> ååããŒ
â¡ãã€ã³ã®çªå·ã確èªããŠç§»å
# controlãæŒããªããbãæŒã -> æãé¢ã -> qãæŒã
control + b -> q
ãããå®è¡ãããšåãã€ã³ã«çªå·ã衚瀺ããããšæããŸãã
ãã®çªå·ãåºæºã«ç§»åãå¯èœã«ãªã£ãŠããŸãã
# controlãæŒããªããbãæŒã -> æãé¢ã -> oãæŒã
control + b -> o
次ã®ãã€ã³ã«ç§»åãã§ããŸããéã«æ»ãã«ã¯control + b -> ;
ã§æ»ãããšãã§ããŸãã
ååããŒã§ç§»åããæ¹ãæåã¯çŽæçã§è¯ããããããªãã§ããã
â¢ãã€ã³ã®å šç»é¢å
ãã€ã³ã¯åºåãã°åºåãã»ã©å°ãããªãã®ã§ããã®ç»é¢ãç»é¢ãã£ã±ãã«ããããšã§äœ¿ãåæããããããšãã§ããŸãã
# controlãæŒããªããbãæŒã -> æãé¢ã -> zãæŒã
control + b -> z
ããäžåºŠåãã³ãã³ããæã€ãšå ã«æ»ããŸãã
â£ãã€ã³ã®åé€
ãã€ã³ãæ¶ãã«ã¯ä»¥äžã®ãã¬ãã£ãã¯ã¹ã§å¯èœã«ãªã£ãŠããŸãã
# controlãæŒããªããbãæŒã -> æãé¢ã -> xãæŒã
control + b -> x
ãããå®è¡ãããšãæ¬åœã«æ¶ããŸããïŒãšãã£ã質åããããŸãã
ããã«yãå ¥åãããšåé€ããããŸãã
ãããã«
ãããŸã§ããŸãã¯åºæ¬ã®ã³ãã³ãã«ã€ããŠè§£èª¬ããŸããã
ã¿ãŒããã«ã®ç»é¢ãåå²ã§ããããšã§ãçæ¹ã§ãµãŒããŒãåãããŠãããŠãå³ã§æ®æ®µã®ã³ãã³ããå©ããããDokcerã³ã³ããã®ãã°ãéããªãããé£ã®ãã€ã³äžã§ã³ã³ããã®äžã«å
¥ã£ãããšçšéã¯æ§ã
ãããŸãã
å¿«é©ãªã·ã§ã«ã©ã€ããéãããã«ãããã²ãè©Šããã ããã
次åã¯ãã®tmuxã®èšå®ãã¡ã€ã«ã®ãããæ¹ãèªåå°çšã®èšå®æ¹æ³ã«ã€ããŠè§£èª¬ããŸãã
次ã®èšäºã¯ãã¡ãð