Tag: wsl

Windows Subsystem for Linux and tmux

If you don’t know by now, Microsoft has created Windows Subsystem for Linux (WSL). I am not going to do a deep dive into how this works (read here to know more), but I will offer a simple what does this mean to us. It means Windows users now have a native (Ubuntu) Linux shell on Windows without using additional virtualization software such as VirtualBox or VMware’s vSphere Desktop. You can use all the things like sed, awk, grep, ssh, and more within Windows. This is all awesome, however the one thing that sucks is the terminal. It’s pretty basic and doesn’t allow tabbing or panes and there really isn’t an alternative terminal for WSL. You could use a Cygwin based solution, but then you’re getting away from the point of WSL. So, I offer you to take the time and learn how to use tmux! This is actually geared toward allowing multiple connections into the same shell. Think of it as having multiple users all connected to the same terminal session. It’s great for getting help from someone remotely or showing others how to do something in shell without everyone hovered over a single screen. Now here is where it becomes really neat for WSL, tmux allows for multiple windows (think tabs) and panes! This instantly makes the generic WSL Terminal much more usable. You can now open up a WSL Terminal and fire up tmux (which is already installed) and start creating multiple windows and panes to work more efficiently.

  • To start a tmux session use: tmux new -s <session name>
  • To create another windows: ctrl + b then c
  • To change to the next window: ctrl + b then n
  • To split panes horizontally: ctrl + b then 
  • To split panes vertically: ctrl + b then %
  • To switch the active pane: ctrl + b then o

Here is a decent tmux cheat sheet that will provide most of your needs -> https://tmuxcheatsheet.com/

Here is an example where I have created 2 windows (named window1 and window2), then I split the first window into 3 panes. Excuse the crappy drawing..

More info:

https://blogs.msdn.microsoft.com/wsl/

https://blogs.msdn.microsoft.com/commandline/2017/04/11/windows-10-creators-update-whats-new-in-bashwsl-windows-console/

https://en.wikipedia.org/wiki/Tmux