{"id":24504766,"url":"https://github.com/dennyzhang/cheatsheet-tmux-a4","last_synced_at":"2026-01-02T06:43:05.548Z","repository":{"id":67455914,"uuid":"141331545","full_name":"dennyzhang/cheatsheet-tmux-A4","owner":"dennyzhang","description":"tmux/tmate Usage in A4","archived":false,"fork":false,"pushed_at":"2020-07-04T04:48:41.000Z","size":660,"stargazers_count":21,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-21T23:29:31.460Z","etag":null,"topics":["cheatsheet","denny-cheatsheets","tmate","tmux"],"latest_commit_sha":null,"homepage":"https://cheatsheet.dennyzhang.com/cheatsheet-tmux-A4","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dennyzhang.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-17T19:01:54.000Z","updated_at":"2024-10-27T13:10:19.000Z","dependencies_parsed_at":"2023-02-22T23:45:30.365Z","dependency_job_id":null,"html_url":"https://github.com/dennyzhang/cheatsheet-tmux-A4","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennyzhang%2Fcheatsheet-tmux-A4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennyzhang%2Fcheatsheet-tmux-A4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennyzhang%2Fcheatsheet-tmux-A4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennyzhang%2Fcheatsheet-tmux-A4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dennyzhang","download_url":"https://codeload.github.com/dennyzhang/cheatsheet-tmux-A4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243706313,"owners_count":20334505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cheatsheet","denny-cheatsheets","tmate","tmux"],"created_at":"2025-01-21T23:26:16.949Z","updated_at":"2026-01-02T06:43:05.542Z","avatar_url":"https://github.com/dennyzhang.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"* Tmux CheatSheet                                                     :Tools:\n:PROPERTIES:\n:type:     tool\n:export_file_name: cheatsheet-tmux-A4.pdf\n:END:\n\n#+BEGIN_HTML\n\u003ca href=\"https://github.com/dennyzhang/cheatsheet-tmux-A4\"\u003e\u003cimg align=\"right\" width=\"200\" height=\"183\" src=\"https://www.dennyzhang.com/wp-content/uploads/denny/watermark/github.png\" /\u003e\u003c/a\u003e\n\u003cdiv id=\"the whole thing\" style=\"overflow: hidden;\"\u003e\n\u003cdiv style=\"float: left; padding: 5px\"\u003e \u003ca href=\"https://www.linkedin.com/in/dennyzhang001\"\u003e\u003cimg src=\"https://www.dennyzhang.com/wp-content/uploads/sns/linkedin.png\" alt=\"linkedin\" /\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv style=\"float: left; padding: 5px\"\u003e\u003ca href=\"https://github.com/dennyzhang\"\u003e\u003cimg src=\"https://www.dennyzhang.com/wp-content/uploads/sns/github.png\" alt=\"github\" /\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cdiv style=\"float: left; padding: 5px\"\u003e\u003ca href=\"https://www.dennyzhang.com/slack\" target=\"_blank\" rel=\"nofollow\"\u003e\u003cimg src=\"https://www.dennyzhang.com/wp-content/uploads/sns/slack.png\" alt=\"slack\"/\u003e\u003c/a\u003e\u003c/div\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\u003cbr/\u003e\n\u003ca href=\"http://makeapullrequest.com\" target=\"_blank\" rel=\"nofollow\"\u003e\u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg\" alt=\"PRs Welcome\"/\u003e\u003c/a\u003e\n#+END_HTML\n\n- PDF Link: [[https://github.com/dennyzhang/cheatsheet-tmux-A4/blob/master/cheatsheet-tmux-A4.pdf][cheatsheet-tmux-A4.pdf]], Category: [[https://cheatsheet.dennyzhang.com/category/tools/][tools]]\n- Blog URL: https://cheatsheet.dennyzhang.com/cheatsheet-tmux-A4\n- Related posts: [[https://cheatsheet.dennyzhang.com/cheatsheet-ssh-A4][Cheatsheet: ssh]], [[https://github.com/topics/denny-cheatsheets][#denny-cheatsheets]]\n\nFile me [[https://github.com/dennyzhang/cheatsheet.dennyzhang.com/issues][Issues]] or star [[https://github.com/dennyzhang/cheatsheet.dennyzhang.com][this repo]].\n** Tmux Basic\n| Name                   | Comment                                |\n|------------------------+----------------------------------------|\n| Create new session     | =tmux new -s denny=                    |\n| List all sessions      | =tmux ls=                              |\n| Attach to one session  | =tmux attach -t denny=                 |\n| Detach session         | =C-b d=                                |\n| Kill one session       | =tmux kill-session -t denny=           |\n| List all shortcut keys | =C-b :list-keys=, =C-b ?= Very useful! |\n| Kill current window    | =C-b \u0026=                                |\n| Default conf file      | =~/.tmux.conf=, =~/.tmate.conf=        |\n** Tmux Layout \u0026 Scroll\n| Name                      | Comment                  |\n|---------------------------+--------------------------|\n| Switch to next pane       | =C-b o=                  |\n| Vertically split pane     | =C-b %=                  |\n| Horizontally split pane   | =C-b \"=                  |\n| Kill current pane         | =C-b x=                  |\n| Swap two panes            | =C-b C-o=                |\n| Resize current pane right | =C-b :resize-pane -R 20= |\n| Resize current pane down  | =C-b :resize-pane -D 10= |\n** Tmux Console Output\n| Name                          | Comment                                          |\n|-------------------------------+--------------------------------------------------|\n| Enter copy mode               | =C-b [=, press q/Esc to exit                     |\n| Search output                 | =C-b C-s=, =C-b C-u=                             |\n| Paste buffer to current panel | =C-b ]=                                          |\n| Page up/down                  | Enter copy mode, then use normal navigation keys |\n| [[http://osxdaily.com/2015/07/07/page-up-page-down-mac-keyboard/][Page up/down in Mac]]           | =Fn + Up Arrow=                                  |\n| Show things in current buffer | =tmux show-buffer=                               |\n| List all buffer               | =tmux list-buffers=                              |\n| Save buffer to file           | =tmux save-buffer foo.txt=                       |\n** Tmate\n| Name                                           | Comment                                              |\n|------------------------------------------------+------------------------------------------------------|\n| see tmate log messages: ssh conn string        | =tmate show-messages=                                |\n| Launch tmate in a detached state               | =tmate -S /tmp/tmate.sock new-session -d=            |\n| Blocks until the SSH connection is established | =tmate -S /tmp/tmate.sock wait tmate-ready=          |\n| Prints tmate SSH connection string             | =tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'= |\n| Make your tmate session big by default         | [[https://apple.stackexchange.com/a/98406][Make your default iterm window big]]                   |\n** More Resources\nhttps://gist.github.com/MohamedAlaa/2961058\n\nhttps://wiki.freebsdchina.org/software/t/tmux\n\nhttps://robots.thoughtbot.com/a-tmux-crash-course\n\nhttps://gist.github.com/Bekbolatov/6840069e51382965fdad\n\nLicense: Code is licensed under [[https://www.dennyzhang.com/wp-content/mit_license.txt][MIT License]].\n\n#+BEGIN_HTML\n \u003ca href=\"https://cheatsheet.dennyzhang.com\"\u003e\u003cimg align=\"right\" width=\"201\" height=\"268\" src=\"https://raw.githubusercontent.com/USDevOps/mywechat-slack-group/master/images/denny_201706.png\"\u003e\u003c/a\u003e\n \u003ca href=\"https://cheatsheet.dennyzhang.com\"\u003e\u003cimg align=\"right\" src=\"https://raw.githubusercontent.com/dennyzhang/cheatsheet.dennyzhang.com/master/images/cheatsheet_dns.png\"\u003e\u003c/a\u003e\n\n \u003ca href=\"https://www.linkedin.com/in/dennyzhang001\"\u003e\u003cimg align=\"bottom\" src=\"https://www.dennyzhang.com/wp-content/uploads/sns/linkedin.png\" alt=\"linkedin\" /\u003e\u003c/a\u003e\n \u003ca href=\"https://github.com/dennyzhang\"\u003e\u003cimg align=\"bottom\"src=\"https://www.dennyzhang.com/wp-content/uploads/sns/github.png\" alt=\"github\" /\u003e\u003c/a\u003e\n \u003ca href=\"https://www.dennyzhang.com/slack\" target=\"_blank\" rel=\"nofollow\"\u003e\u003cimg align=\"bottom\" src=\"https://www.dennyzhang.com/wp-content/uploads/sns/slack.png\" alt=\"slack\"/\u003e\u003c/a\u003e\n#+END_HTML\n* org-mode configuration                                           :noexport:\n#+STARTUP: overview customtime noalign logdone showall\n#+DESCRIPTION:\n#+KEYWORDS:\n#+LATEX_HEADER: \\usepackage[margin=0.6in]{geometry}\n#+LaTeX_CLASS_OPTIONS: [8pt]\n#+LATEX_HEADER: \\usepackage[english]{babel}\n#+LATEX_HEADER: \\usepackage{lastpage}\n#+LATEX_HEADER: \\usepackage{fancyhdr}\n#+LATEX_HEADER: \\pagestyle{fancy}\n#+LATEX_HEADER: \\fancyhf{}\n#+LATEX_HEADER: \\rhead{Updated: \\today}\n#+LATEX_HEADER: \\rfoot{\\thepage\\ of \\pageref{LastPage}}\n#+LATEX_HEADER: \\lfoot{\\href{https://github.com/dennyzhang/cheatsheet-tmux-A4}{GitHub: https://github.com/dennyzhang/cheatsheet-tmux-A4}}\n#+LATEX_HEADER: \\lhead{\\href{https://cheatsheet.dennyzhang.com/cheatsheet-tmux-A4}{Blog URL: https://cheatsheet.dennyzhang.com/cheatsheet-tmux-A4}}\n#+AUTHOR: Denny Zhang\n#+EMAIL:  denny@dennyzhang.com\n#+TAGS: noexport(n)\n#+PRIORITIES: A D C\n#+OPTIONS:   H:3 num:t toc:nil \\n:nil @:t ::t |:t ^:t -:t f:t *:t \u003c:t\n#+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:t pri:nil tags:not-in-toc\n#+EXPORT_EXCLUDE_TAGS: exclude noexport\n#+SEQ_TODO: TODO HALF ASSIGN | DONE BYPASS DELEGATE CANCELED DEFERRED\n#+LINK_UP:\n#+LINK_HOME:\n* #  --8\u003c-------------------------- separator ------------------------\u003e8-- :noexport:\n* [#A] Blog: tmux一个优秀的终端复用软件,类似GNU Screen            :noexport:\n| Name                   | Comment                                                         |\n|------------------------+-----------------------------------------------------------------|\n| C-b d                  | 退出tmux                                                        |\n| C-b c                  | 创建新窗口                                                      |\n| C-b n                  | 切换至下一窗口                                                  |\n| C-b :                  | 进入命令行模式, 例如split-window, rename-window, rename-session |\n| C-b Ctrl+方向          | 以1个单元格为单位移动边缘以调整当前面板大小                     |\n\n- tmux使用C/S模型构建,主要包括以下单元模块:\n| Name    | Comment                                    |\n|---------+--------------------------------------------|\n| server  | 服务器.输入tmux命令时就开启了一个服务器. |\n| session | 会话.一个服务器可以包含多个会话.         |\n| window  | 窗口.一个会话可以包含多个窗口.           |\n| pane    | 面板.一个窗口可以包含多个面板.           |\n** TODO mac make tmux make the font bigger\n** DONE tmux page up and page down: i, c-b c-f\n   CLOSED: [2015-10-13 Tue 15:56]\n#+BEGIN_EXAMPLE\n这个可以起tmux\ntmux里,一两个小时基本不过期.\n在 ~/.tmux.conf 里加入一下配置内容:\n#用vi模式操作 翻页用c-b c-f等 可以把vi替换成 emacs\nsetw -g mode-keys vi\n#+END_EXAMPLE\n** DONE Create new-window with current directory in tmux\n   CLOSED: [2017-06-27 Tue 17:27]\nhttps://unix.stackexchange.com/questions/12032/create-new-window-with-current-directory-in-tmux\ncat \u003e ~/.tmux.conf \u003c\u003cEOF\nbind c new-window -c \"#{pane_current_path}\"\nbind '\"' split-window -c \"#{pane_current_path}\"\nbind % split-window -h -c \"#{pane_current_path}\"\nEOF\n\ncat ~/.tmux.conf\n* DONE tmate: Instant Terminal Sharing                             :noexport:\n  CLOSED: [2018-07-18 Wed 09:38]\nhttps://github.com/tmate-io/tmate\n** DONE [#A] copy k8s yaml to tmux, the two lines mess up: :set paste, then press i\n  CLOSED: [2018-07-18 Wed 16:40]\n** DONE tmate copy buffer to mac clipboard\n  CLOSED: [2018-07-18 Wed 16:39]\nhttp://www.rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting/\nhttps://awhan.wordpress.com/2010/06/20/copy-paste-in-tmux/\n** TODO [#A] Emacs Can't ssh to tmate                              :IMPORTANT:\nhost host\n     HostName sf2.tmate.io\n     # Port 12360\n     StrictHostKeyChecking no\n     IdentityFile ~/.ssh/id_rsa\n     User Bkk4XXXXXXXXX\n** TODO tmux copy and paste\n** TODO tmux copy the whole buffer context\nhttp://stackoverflow.com/questions/12289227/how-do-i-copy-entire-contents-of-file-1-pane-in-tmux-emacs-copy-mode\n** #  --8\u003c-------------------------- separator ------------------------\u003e8-- :noexport:\n** TODO tmux zsh\n** TODO tmate one session\n** TODO tmate: disable C-b c\n** TODO re-run the tmux last ssh command\n** TODO [#A] emacs tramp doesn't work with tmux\n** TODO Save sessions of previous tmux ssh\n** #  --8\u003c-------------------------- separator ------------------------\u003e8-- :noexport:\n** TODO [#A] tmate: ssh directly\n* more content                                                     :noexport:\n** file1\n# Start tmux:\ntmux\n\n# Detach from tmux:\nCtrl-b d\n\n# Restore tmux session:\ntmux attach\n\n# Detach an already attached session (great if you are moving devices with different screen resolutions)\ntmux attach -d\n\n# Display session:\ntmux ls\n\n# Rename session:\nCtrl-b $\n\n# Switch session:\nCtrl-b s\n\n# Start a shared session:\ntmux -S /tmp/your_shared_session\nchmod 777 /tmp/your_shared_session\n\n# Help screen (Q to quit):\nCtrl-b ?\n\n# Scroll in window:\nCtrl-b PageUp/PageDown\n\n# Reload configuation file\nCtrl-b : source-file /path/to/file\n\n# Window management\n# =================\n\n# Create window:\nCtrl-b c\n\n# Destroy window:\nCtrl-b x\n\n# Switch between windows:\nCtrl-b [0-9]\nor\nCtrl-b Arrows\n\n# Split windows horizontally:\nCtrl-b %\n\n# Split windows vertically:\nCtrl-b \"\n* TODO [#A] tmate sometimes doesn't work                           :noexport:\n* TODO [#A] tmate copy files in client side              :noexport:IMPORTANT:\n* TODO ngrok + tmux: setup ssh reverse proxy                       :noexport:\nhttps://ngrok.com/docs\n** setup ssh reverse proxy ngrok\n** ngrok tmux ssh\n https://gist.github.com/karampok/64067862052b2565b348812f0cb13bfc\n https://gist.github.com/keithpitty/38266d38d44d06fabf6b707df608f73e\n\n ngrok authtoken 2sVqHXBmmsSmZfCaVcrqR_6BzxZJu94dv137xigzkyV\n\n gh-auth add --users=\"pks\" --command=\"$(which tmux) attach -t tc\"\n\n ssh pks@0.tcp.ngrok.io -p 12956 -vvvv\n\n#+BEGIN_EXAMPLE\n zdenny-a02:~ zdenny$ ngrok authtoken 2sVqHXBmmsSmZfCaVcrqR_6BzxZJu94dv137xigzkyV\n Authtoken saved to configuration file: /Users/zdenny/.ngrok2/ngrok.yml\n\n ngrok tcp 22\n\n ssh zdenny@0.tcp.ngrok.io -p 10550\n#+END_EXAMPLE\n* TODO tmux screen get locked                                      :noexport:\n* TODO tmux search: list all matched entries                       :noexport:\n* #  --8\u003c-------------------------- separator ------------------------\u003e8-- :noexport:\n* TODO mac tmux page up and page down with Fn key                  :noexport:\n* Scripts                                                          :noexport:\n- Copy to mac clipboard\n\nNote: Only works for the laptop who hosts the tmux/tmate session\n\n#+BEGIN_SRC sh\nbrew install reattach-to-user-namespace\n\n# In tmux, search a region. Then save to pbcopy\ntmux save-buffer - | reattach-to-user-namespace pbcopy\n\n# In mac terminal\npbpaste\n#+END_SRC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennyzhang%2Fcheatsheet-tmux-a4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdennyzhang%2Fcheatsheet-tmux-a4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennyzhang%2Fcheatsheet-tmux-a4/lists"}