Ubuntu – A better terminal experience for Windows Subsystem for Linux(WSL)

command linewindows-subsystem-for-linux

The terminal for Windows Subsystem for Linux (WSL) is fairly minimal. I have not used the terminal on Windows very much – I generally use Ubuntu or OSX – but I am surprised that the default terminal is so bare.

Is it possible to either:

  1. Connect a Windows terminal program to WSL or

  2. Launch the Ubuntu terminal program from WSL as an X window?

Best Answer

I personally do the latter: use VcXsrv as my X server in multiple windows mode, then launch the xfce4-terminal (because gnome-terminal had visual issues that I didn't care to try to learn how to fix), and suddenly I have a competent terminal with font and color support.

I found I needed to add these to my bashrc...

export DISPLAY="localhost:0"
export TERM=xterm-256color

Do the fix from this reddit for dbus:

sudo sed -i 's$<listen>.*</listen>$<listen>tcp:host=localhost,port=0</listen>$' /etc/dbus-1/session.conf

I also installed compiz and I use the cbwin project to run windows programs from my xfce4-terminal shell.

I am very happy with this setup and use NeoVim + lots of native linux plugins even though my "for-work" machine must be Windows. :)

It is also possible to start an SSH server in Bash-on-Linux-on-Windows and then connect to it, say from MinTTY like from Cygwin.

PS: to make launching xfce4-terminal painless and without the extra bash cmd window, I wrote a program that does nothing but start the bash process with arguments to start xfce4-terminal without a console window. I did this in C# - basically use arguments "UseShellExecute" false and "CreateNoWindow" true. I then pinned that to my taskbar and it's almost seemless.

EDIT: The answer with VBScript is brilliant. Here's that same script, but a JScript version...

WScript.CreateObject("WScript.Shell").run('bash.exe -l -c "DISPLAY=:0.0 xfce4-terminal"', 0, false);