linux:tmux

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:tmux [2022/05/20 05:26] – [簡単な基本操作] ともやんlinux:tmux [2023/04/23 07:07] (現在) – [参考文献] ともやん
行 2: 行 2:
 ====== tmux - terminal multiplexer (端末多重接続ソフトウェア) ====== ====== tmux - terminal multiplexer (端末多重接続ソフトウェア) ======
 {{windows:wsl_tmux.png?470|tmux 画面}}\\ {{windows:wsl_tmux.png?470|tmux 画面}}\\
-本家: [[http://tmux.github.io/|Home · tmux/tmux Wiki]]\\ +本家: [[ghi>tmux|Home · tmux/tmux Wiki]] ([[https://github-com.translate.goog/tmux/tmux/wiki?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ 
-ソースコード: [[https://github.com/tmux/tmux|tmux/tmux: tmux source code]]\\+ソースコード: [[git>tmux/tmux|tmux/tmux: tmux source code]]\\ 
 +ドキュメント: [[rtd>tmuxguide.readthedocs.io|TMUX Guide — TMUX Guide documentation]] ([[https://tmuxguide-readthedocs-io.translate.goog/en/latest/tmux/tmux.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ 
 +Linux manual: [[https://man7.org/linux/man-pages/man1/tmux.1.html|tmux(1) - Linux manual page]] ([[https://man7-org.translate.goog/linux/man-pages/man1/tmux.1.html?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ 
 +Arch Linux[[arc>Tmux|tmux - ArchWiki]]\\
  
 **tmux** とは、Unix ライクなオペレーティングシステム用の端末多重接続ソフトウェアである。\\ **tmux** とは、Unix ライクなオペレーティングシステム用の端末多重接続ソフトウェアである。\\
 単一のウィンドウで複数の端末セッションにアクセスできる。同時に複数のコマンドラインプログラムを実行する際に有用である。\\ 単一のウィンドウで複数の端末セッションにアクセスできる。同時に複数のコマンドラインプログラムを実行する際に有用である。\\
 tmux は制御端末からプロセスを切断することもでき、SSH セッションを SSH 接続をしていない状態でも維持することができる。\\ tmux は制御端末からプロセスを切断することもでき、SSH セッションを SSH 接続をしていない状態でも維持することができる。\\
-[[wpjp>Tmux|tmux Wikipedia]] より\\+[[wwjp>Tmux|Wikiwand Tmux]] より\\
  
 ===== 簡単な基本操作 ===== ===== 簡単な基本操作 =====
   * **Ctrl + b** を入力後 **?** でキーバインド一覧   * **Ctrl + b** を入力後 **?** でキーバインド一覧
 +  * **Ctrl + b** を入力後 **d** でセッションをデタッチ(<wrap em>__セッションを残した状態で tmux 実行前のセッションに戻る__</wrap>)
   * **Ctrl + b** を入力後 **Shift + 2 (")** で上下に分割   * **Ctrl + b** を入力後 **Shift + 2 (")** で上下に分割
   * **Ctrl + b** を入力後 **Shift + 5 (%)** で左右に分割   * **Ctrl + b** を入力後 **Shift + 5 (%)** で左右に分割
行 22: 行 26:
  
 ===== セッションのアタッチ ===== ===== セッションのアタッチ =====
-<WRAP prewrap 100% #result+<WRAP color_term
-<code+<WRAP color_command><html><pre
-$ tmux a +<b class=BOLD>a</b>ttach-session [<b class=HIK>-dErx</b>] [<b class=HIK>-c</b> <b class=ITA>working-directory</b>] [<b class=HIK>-f</b> <b class=ITA>flags</b>] [<b class=HIK>-t</b> <b class=ITA>target-session</b>] (alias: attach) 
-</code>+<b class=GRN>$</b> <b class=HIY>tmux</b> 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> a <b class=HIK>-t</b>
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +===== セッションのデタッチ ===== 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=BOLD>det</b>ach-client <b class=HIK>[-aP] [-E <b class="WHI ITA">shell-command</b>] [-s <b class="WHI ITA">target-session</b>] [-t <b class="WHI ITA">target-client</b>]</b> (alias: detach) 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> det -s 0 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> ls 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +0: 1 windows (created Fri Oct 14 14:47:17 2022) [110x45] 
 +1: 1 windows (created Fri Oct 14 14:49:39 2022) [237x35] (attached) 
 +</pre></html></WRAP> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> det -s 1 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> ls 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +0: 1 windows (created Fri Oct 14 14:47:17 2022) [110x45] 
 +1: 1 windows (created Fri Oct 14 14:49:39 2022) [237x35] 
 +</pre></html></WRAP>
 </WRAP> </WRAP>
  
行 32: 行 64:
 **ssh** 再接続後にアタッチできる。\\ **ssh** 再接続後にアタッチできる。\\
 セッションを確認するには...\\ セッションを確認するには...\\
-<WRAP prewrap 100% #result+<WRAP color_term
-<code+<WRAP color_command><html><pre
-$ tmux ls+<b class=GRN>$</b> <b class=HIY>tmux</b> ls 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre>
 0: 1 windows (created Thu Jun 11 04:44:30 2020) 0: 1 windows (created Thu Jun 11 04:44:30 2020)
-$ tmux a +</pre></html></WRAP> 
-</code>+<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> a <b class=HIK>-t</b>
 +</pre></html></WRAP>
 </WRAP> </WRAP>
  
 ===== セッションの終了 ===== ===== セッションの終了 =====
-<WRAP prewrap 100% #result+<WRAP color_term
-<code+<WRAP color_command><html><pre
-$ tmux ls+<b class=GRN>$</b> <b class=HIY>tmux</b> ls 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre>
 0: 1 windows (created Thu Jun 11 04:44:30 2020) 0: 1 windows (created Thu Jun 11 04:44:30 2020)
-$ tmux kill-session +</pre></html></WRAP> 
-$ tmux ls+<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> kill-session 
 +<b class=GRN>$</b> <b class=HIY>tmux</b> ls 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre>
 no server running on /tmp/tmux-1000/default no server running on /tmp/tmux-1000/default
-</code>+</pre></html></WRAP> 
 +</WRAP> 
 + 
 +===== カスタマイズ ===== 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>nano</b> ~/.tmux.conf 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +#マウス操作有効化 
 +set -g mouse on 
 +#スクロールバック行数 
 +set-option -g history-limit 100000 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +===== Python の libtmux で tmux を操作する ===== 
 +[[python:libtmux|libtmux - tmux を制御するための Python スクリプトライブラリ]]\\ 
 +\\ 
 +libtmux をインストールする🤔\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> install <b class=HIK>--user</b> libtmux 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Collecting libtmux 
 +  Downloading libtmux-0.21.0-py3-none-any.whl (47 kB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>47.5/47.5 kB</b> <b class=RED>296.3 kB/s</b> eta <b class=CYN>0:00:00</b> 
 +Installing collected packages: libtmux 
 +Successfully installed libtmux-0.21.0 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +ptpython をインストールする🤔\\ 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> install <b class=HIK>--user</b> ptpython 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Collecting ptpython 
 +  Downloading ptpython-3.0.23-py2.py3-none-any.whl (63 kB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>64.0/64.0 kB</b> <b class=RED>340.0 kB/s</b> eta <b class=CYN>0:00:00</b> 
 +Collecting appdirs 
 +  Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB) 
 +Collecting jedi>=0.16.0 
 +  Using cached jedi-0.18.2-py2.py3-none-any.whl (1.6 MB) 
 +Collecting prompt-toolkit&lt;3.1.0,>=3.0.28 
 +  Using cached prompt_toolkit-3.0.38-py3-none-any.whl (385 kB) 
 +Collecting pygments 
 +  Using cached Pygments-2.14.0-py3-none-any.whl (1.1 MB) 
 +Collecting parso&lt;0.9.0,>=0.8.0 
 +  Using cached parso-0.8.3-py2.py3-none-any.whl (100 kB) 
 +Collecting wcwidth 
 +  Using cached wcwidth-0.2.6-py2.py3-none-any.whl (29 kB) 
 +Installing collected packages: wcwidth, appdirs, pygments, prompt-toolkit, parso, jedi, ptpython 
 +Successfully installed appdirs-1.4.4 jedi-0.18.2 parso-0.8.3 prompt-toolkit-3.0.38 ptpython-3.0.23 pygments-2.14.0 wcwidth-0.2.6 
 +</pre></html></WRAP>
 </WRAP> </WRAP>
  
 ===== 参考文献 ===== ===== 参考文献 =====
-[[https://qiita.com/nl0_blu/items/9d207a70ccc8467f7bab|tmuxを必要最低限で入門して使う Qiita]]\\ +[[https://wiki.archlinux.jp/index.php/Tmux|tmux - ArchWiki]]\\ 
-[[https://qiita.com/b4b4r07/items/01359e8a3066d1c37edc|ターミナルマルチプレクサ tmux をカスタマイズする - Qiita]]\\ +[[https://libtmux.git-pull.com|libtmux]]\\ 
-[[https://qiita.com/nmrmsys/items/03f97f5eabec18a3a18b|tmuxチートシート - Qiita]]\\ +[[https://www.hostinger.com/tutorials/tmux-beginners-guide-and-cheat-sheet/|tmux: How to Install and Use It + Cheat Sheet]] ([[https://www-hostinger-com.translate.goog/tutorials/tmux-beginners-guide-and-cheat-sheet/?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\ 
-[[https://qiita.com/taknya/items/cd7bf686f2a4e71e8af8|tmuxの基本的な操作方法のまとめ - Qiita]]\\+ 
 +==== 付録 ==== 
 +[[tw>tomoyan596sp/status/1636109800965828608|tmuxをpythonから操作するに、このようなライブラリが存在していても、国内の検索上位は「5年が経過していす」だそうです😅海外の動向しか見ないこにしてます🤔]]\\
  
  • linux/tmux.1652991981.txt.gz
  • 最終更新: 2022/05/20 05:26
  • by ともやん