﻿{"id":440,"date":"2018-07-18T20:34:18","date_gmt":"2018-07-18T18:34:18","guid":{"rendered":"https:\/\/blog.pjsen.eu\/?p=440"},"modified":"2018-12-26T11:14:48","modified_gmt":"2018-12-26T10:14:48","slug":"how-to-run-tmux-in-git-bash-on-windows","status":"publish","type":"post","link":"https:\/\/blog.pjsen.eu\/?p=440","title":{"rendered":"How to run Tmux in GIT Bash on Windows"},"content":{"rendered":"<div id=\"attachment_441\" style=\"width: 738px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-441\" class=\"wp-image-441 size-full\" src=\"https:\/\/blog.pjsen.eu\/wp-content\/uploads\/2018\/07\/tmuxgitbash.png\" alt=\"\" width=\"728\" height=\"344\" srcset=\"https:\/\/blog.pjsen.eu\/wp-content\/uploads\/2018\/07\/tmuxgitbash.png 728w, https:\/\/blog.pjsen.eu\/wp-content\/uploads\/2018\/07\/tmuxgitbash-300x142.png 300w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><p id=\"caption-attachment-441\" class=\"wp-caption-text\">Tmux running under Git Bash default terminal with two shell processes<\/p><\/div>\n<p>I know everyone uses <a href=\"http:\/\/cmder.net\/\">Cmder<\/a>, but it didn&#8217;t work for me. It hung a few times, it has way too many options, it has issues sending signal to kill a process. I gave up on using it. I work with carefully configured default Windows console and believe it or not, it serves the purpose. I also know you can use <a href=\"https:\/\/en.wikipedia.org\/wiki\/Windows_Subsystem_for_Linux\">Windows Subsystem For Linux<\/a> under Windows 10, which is truly amazing, but I am just talking about the cases where you need standard Git for Windows installation.<\/p>\n<p>When I worked with Unix I liked <a href=\"https:\/\/en.wikipedia.org\/wiki\/GNU_Screen\">GNU Screen<\/a>, which is terminal multiplexer. It gives you a bunch of keyboard shortcuts to create separate shell processes under the same terminal window. The problem is, it is not available under GIT Bash. But it turns out, its alternative &#8212; <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tmux\">Tmux<\/a> is.<\/p>\n<p>I did a little research and have found that GIT Bash uses MINGW compilation of GNU tools. It uses only selected ones. You can install the whole distribution of the tools from <a href=\"https:\/\/www.msys2.org\/\">https:\/\/www.msys2.org\/<\/a> and run a command to install <em>Tmux<\/em>. And then copy some files to installation folder of Git. This is what you do:<\/p>\n<ol>\n<li>Install before-mentioned msys2 package and run bash shell<\/li>\n<li>Install tmux using the following command: <code>pacman -S tmux<\/code><\/li>\n<li>Go to msys2 directory, in my case it is <code>C:\\msys64\\usr\\bin<\/code><\/li>\n<li>Copy <code>tmux.exe<\/code> and <code>msys-event-2-1-4.dll<\/code> to your Git for Windows directory, mine is <code>C:\\Program Files\\Git\\usr\\bin<\/code>. Please note, that in future, you can see this file with the version number higher than <em>2-1-4<\/em><\/li>\n<\/ol>\n<p>And you are ready to go. <strong> Please note, that I do this on 64-bit installations of Git and MSYS <\/strong>. Now when you run Git Bash enter <code>tmux<\/code>. My most frequently used commands are:<\/p>\n<ul>\n<li><code>CTRL+B<\/code>, <span style=\"color: gray;\">(release and then) <\/span> <code>C<\/code> \u2014 create new shell within existing terminal window<\/li>\n<li><code>CTRL+B<\/code>, <code>N<\/code> \u2014 switch between shells<\/li>\n<li><code>CTRL+B<\/code>, <em>a digit<\/em> \u2014 switch to the chosen shell by the corresponding number<\/li>\n<li><code>CTRL+B<\/code>, <code>\"<\/code> \u2014 split current window horizontally into panels (panels are inside windows)<\/li>\n<li><code>CTRL+B<\/code>, <code>o<\/code> \u2014 switch between panels in current window<\/li>\n<li><code>CTRL+B<\/code>, <code>x<\/code> \u2014 close panel<\/li>\n<\/ul>\n<p>This is everything you need to know to start using it. Simple. There are many other options which you can explore yourself, for example here <a href=\"http:\/\/hyperpolyglot.org\/multiplexers\">http:\/\/hyperpolyglot.org\/multiplexers<\/a>.<\/p>\n<p>Update 1: Users in comments are reporting the method not always works. If you have any experiences with this method please feel free to comment, so that we can figure out what are the circumstances under which it works<\/p>\n<p>Update2: I managed to run this on Windows 7, Windows 2012 R2 and Windows 10. My Git installation is set up to use MinTTy console and tmux works only when run from this console, not from default Windows command line console. Still haven&#8217;t figured out what are precise requirements for this trick<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I know everyone uses Cmder, but it didn&#8217;t work for me. It hung a few times, it has way too many options, it has issues sending signal to kill a process. I gave up on using it. I work with carefully configured default Windows console and believe it or not, it serves the purpose. I<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-440","post","type-post","status-publish","format-standard","hentry","category-general-programming","category-quick-tip"],"_links":{"self":[{"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=\/wp\/v2\/posts\/440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=440"}],"version-history":[{"count":0,"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=\/wp\/v2\/posts\/440\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pjsen.eu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}