{"id":135,"date":"2016-06-08T09:39:48","date_gmt":"2016-06-08T17:39:48","guid":{"rendered":"http:\/\/blogs.msdn.microsoft.com\/commandline\/?p=135"},"modified":"2019-02-26T12:37:07","modified_gmt":"2019-02-26T20:37:07","slug":"tmux-support-arrives-for-bash-on-ubuntu-on-windows","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/commandline\/tmux-support-arrives-for-bash-on-ubuntu-on-windows\/","title":{"rendered":"Tmux support arrives for Bash on Ubuntu on Windows"},"content":{"rendered":"<p>In Windows 10 build 14361, available now to\u00a0Windows Insiders fast-ring users, we&#8217;ve added Pseudo Terminal support to Windows Subsystem for Linux (WSL) which, along with improvements to Windows Console&#8217;s much improved support for rendering <a href=\"http:\/\/invisible-island.net\/xterm\/ctlseqs\/ctlseqs.html\">VT control sequences<\/a>, enables Tmux support to light-up your console!<\/p>\n<p>For those not familiar with it, Tmux is a terminal multiplexer &#8211; a popular (even essential) command-line tool that allows one to divide a console\/terminal window into multiple &#8220;panes&#8221; and render the output of a shell and\/or tool in each &#8220;pane&#8221;, and to switch input between each pane.<\/p>\n<p>Tmux relies on a *NIX feature called <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pseudoterminal\" target=\"_blank\">Pseudo Terminals (PTY)<\/a> that are attached to a process running a shell\/tool, and which virtualize the behaviors of a terminal. A physical terminal (TTY) can then be attached to any PTY &#8230; or more than one in the case of Tmux: Tmux &#8220;attaches&#8221; each &#8220;pane&#8221; it contains to a separate PTY, allowing a single console\/terminal to render the output of several *NIX tools in their own &#8220;pane&#8221; within the console.<\/p>\n<p>To start, let&#8217;s open Bash on Ubuntu on Windows and install Tmux using apt-get:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/1-install.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-145\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/1-install-300x228.png\" alt=\"1-install\" width=\"400\" \/><\/a><\/p>\n<p>We start Tmux by running &#8230; well &#8230; tmux \ud83d\ude42 This will clear your screen and add a (customizable) status bar to the bottom of the screen.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/2-run.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-155\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/2-run-300x228.png\" alt=\"2-run\" width=\"400\" \/><\/a><\/p>\n<p>First, let&#8217;s split the current pane vertically using [CTRL B] + [%]:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/3-split-v.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-165\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/3-split-v-300x228.png\" alt=\"3-split-v\" width=\"400\" \/><\/a><\/p>\n<p>Now let&#8217;s split this new pane horizontally using [CTRL B] + [&#8220;]<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/4-split-h.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-175\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/4-split-h-300x231.png\" alt=\"4-split-h\" width=\"400\" \/><\/a><\/p>\n<p>Cool! So, using [CTRL B] + [Arrow-key | P | N] we can navigate between panes. Let&#8217;s return to the left-hand pane and open a file in vim (e.g. &#8220;vim hello.cpp&#8221; in this case):<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/5-vim.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-176\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/5-vim-300x231.png\" alt=\"5-vim\" width=\"400\" \/><\/a><\/p>\n<p>If we now navigate to the top-right pane again, and run &#8220;htop&#8221;, we can see a textual process monitor:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/6-htop.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-186\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/6-htop-300x231.png\" alt=\"6-htop\" width=\"400\" \/><\/a><\/p>\n<p>Move to the bottom-right pane and run &#8220;fortune | cowsay&#8221; (install using apt-get if they&#8217;re missing), and you can see a cow read out the fortune cookie message of the day \ud83d\ude42<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/7-cowsay.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-195\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/7-cowsay-300x231.png\" alt=\"7-cowsay\" width=\"400\" \/><\/a><\/p>\n<p>Three panes just aren&#8217;t fancy enough, so let&#8217;s split the left hand pane again: Navigate to the left pane using [CTRL B] + [Arrow-key] and hit [CTRL B] + [&#8220;] to split horizontally.<\/p>\n<p>Now run &#8220;cacademo&#8221; (install using apt-get install caca-utils) and you&#8217;ll see a\u00a0selection of\u00a0crazy swirling and dripping\u00a0text-effects!:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/8-split-cacademo.png\"><img decoding=\"async\" class=\"alignnone size-medium wp-image-196\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/33\/2019\/02\/8-split-cacademo-300x231.png\" alt=\"8-split-cacademo\" width=\"400\" \/><\/a><\/p>\n<p>This is just a taste of what Tmux can do, but as you can imagine, its an amazingly powerful multi-paned terminals within a terminal tool that you can use to build dashboards of tools to suit many of your geeky needs!<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Windows 10 build 14361, available now to\u00a0Windows Insiders fast-ring users, we&#8217;ve added Pseudo Terminal support to Windows Subsystem for Linux (WSL) which, along with improvements to Windows Console&#8217;s much improved support for rendering VT control sequences, enables Tmux support to light-up your console! For those not familiar with it, Tmux is a terminal multiplexer [&hellip;]<\/p>\n","protected":false},"author":910,"featured_media":4249,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[6,9],"tags":[22,31,42,51,61,72],"class_list":["post-135","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-console","category-bash-on-ubuntu-on-windows","tag-bash","tag-console","tag-linux","tag-pty","tag-tmux","tag-wsl"],"acf":[],"blog_post_summary":"<p>In Windows 10 build 14361, available now to\u00a0Windows Insiders fast-ring users, we&#8217;ve added Pseudo Terminal support to Windows Subsystem for Linux (WSL) which, along with improvements to Windows Console&#8217;s much improved support for rendering VT control sequences, enables Tmux support to light-up your console! For those not familiar with it, Tmux is a terminal multiplexer [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts\/135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/users\/910"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/comments?post=135"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/posts\/135\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/media\/4249"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/media?parent=135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/categories?post=135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/commandline\/wp-json\/wp\/v2\/tags?post=135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}