A better terminal experience for Windows Subsystem for Linux(WSL)?

Solution 1:

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);

Solution 2:

It took a little while to figure out all the implied steps in the other answers, so here's a step by step summary:

  1. On Windows, install VcXsrv or XMing.
  2. In Bash for Windows, install the terminal: sudo apt-get install xfce4-terminal.
  3. Add export DISPLAY=:0 to your .bashrc. (Adding it to .profile or .bash_profile didn't work for me). This will allow you to start xfce4-terminal properly from bash, but is orthogonal to the command below.
  4. Run the following in a shortcut or in the Run prompt (as @OhJeez suggested in the comments):

    powershell -windowstyle hidden -Command "iex \"bash ~ -c 'DISPLAY=:0 xfce4-terminal'\" "
    

Other notes:

  • The ~ starts bash in your home directory, you can remove it to start in whatever directory the .vbs file is in, instead. So it's convenient to put it in C:\Users\foo, for example.
  • Note that XMing has to be running for the script to work; in order to start it automatically with Windows you can follow the instructions in this article.
  • Emacs 24 (included with Ubuntu 14.04) doesn't seem to work with XMing; I had to install a newer version as suggested in this post.

Solution 3:

I created (and use) an open source terminal for Windows Subsystem for Linux (WSL) called wsl-terminal, it is based on mintty and wslbridge.

screenshot