In Windows 10 build 14361, available now to Windows Insiders fast-ring users, we’ve added Pseudo Terminal support to Windows Subsystem for Linux (WSL) which, along with improvements to Windows Console’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 – a popular (even essential) command-line tool that allows one to divide a console/terminal window into multiple “panes” and render the output of a shell and/or tool in each “pane”, and to switch input between each pane.
Tmux relies on a *NIX feature called Pseudo Terminals (PTY) 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 … or more than one in the case of Tmux: Tmux “attaches” each “pane” it contains to a separate PTY, allowing a single console/terminal to render the output of several *NIX tools in their own “pane” within the console.
To start, let’s open Bash on Ubuntu on Windows and install Tmux using apt-get:
We start Tmux by running … well … tmux 🙂 This will clear your screen and add a (customizable) status bar to the bottom of the screen.
First, let’s split the current pane vertically using [CTRL B] + [%]:
Now let’s split this new pane horizontally using [CTRL B] + [“]
Cool! So, using [CTRL B] + [Arrow-key | P | N] we can navigate between panes. Let’s return to the left-hand pane and open a file in vim (e.g. “vim hello.cpp” in this case):
If we now navigate to the top-right pane again, and run “htop”, we can see a textual process monitor:
Move to the bottom-right pane and run “fortune | cowsay” (install using apt-get if they’re missing), and you can see a cow read out the fortune cookie message of the day 🙂
Three panes just aren’t fancy enough, so let’s split the left hand pane again: Navigate to the left pane using [CTRL B] + [Arrow-key] and hit [CTRL B] + [“] to split horizontally.
Now run “cacademo” (install using apt-get install caca-utils) and you’ll see a selection of crazy swirling and dripping text-effects!:
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!