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?

share|improve this question
up vote 15 down vote accepted

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);
share|improve this answer

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.
share|improve this answer
  • 1
    Thanks for your help. When i run the script, nothing seems to happen (Xming server is running). However, if I open bash and run xfce4-terminal it works fine. Furthermore, if I run bash -l -c xfce4-terminal from windows cmd, I get a warning Gtk-WARNING **: cannot open display: and nothing happens. I'm quite confused as I figured these commands should behave identically, any guesses? – rperryng Jul 10 '17 at 16:04
  • @rperryng yeah - I'm also trying to get a one-liner to open xfce without the ugly bash command prompt in between, but no luck yet. – Andrew Mao Jul 17 '17 at 20:21
  • 1
    Best solution for starting xfce4-terminal using shortcut. There is a flicker, but no window remains behind: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -Command "iex \"bash.exe ~ -c 'DISPLAY=:0 xfce4-terminal'\" " Another version which will start Xming if it's not running: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -Command "iex '& \"C:\Program Files (x86)\Xming\Xming.exe\" -multiwindow'; iex \"bash.exe ~ -c 'DISPLAY=:0 xfce4-terminal'\" " – OhJeez Jul 25 '17 at 21:45
  • @OhJeez nice, thanks for working out the intricacies of that command. – Andrew Mao Jul 28 '17 at 18:44
  • Workaround for high-resolution displays. If you have a 4k display, you will have blurry fonts in your terminal. To fix this you will need: 1. Use "VcXsrv Windows X Server" instead of Xing sourceforge.net/projects/vcxsrv 2. Run the xserver in compatibility mode. To do this you will need: click on VcXsrv shortcut with the right mouse button. Choose "Properties". On the "Compatibility" tab set checkbox against "Override high DPI scaling behavior..." and choose "Application" in the next dropdown. 3. Run xfce4-terminal and change font setting. Change font to a larger one. – koorchik Sep 30 '17 at 17:33

On a fresh Ubuntu install, I've just installed XMing (in Windows) then (in Ubuntu) xfce4-terminal, and after I export DISPLAY=:0, it worked.

To get rid of Windows's default console, this VBS script does the job:

WScript.CreateObject("WScript.Shell").run "bash -l -c xfce4-terminal", 0, True

(With $DISPLAY set in your .profile.)

edit: And to make the script pin'able, create a shortcut with target wscript "C:\path\to\thescript.vbs".

share|improve this answer
  • The VBS seems to work, however the terminal window is open and closed right after. How can I keep it running? – TCB13 Apr 15 '17 at 22:04

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

share|improve this answer

On Windows:

  • Click on the upper left corner of the bash window.
  • In the menu that opens select 'Properties'
  • Set options that you want like font etc.(there is even an Ubuntu mono font!)
  • After setting properties they will be applied for current window. To set them as default click the upper left of the window and click defaults.
  • You can press Alt+Enter to toggle full screen mode.

I hope this helps.

share|improve this answer
  • I'd like to point out it has the same appearance / usage as Ubuntu's (Gnome's) terminal except it adds mouse support. ie You can click the column headings in htop – WinEunuuchs2Unix Oct 7 '17 at 23:42

ConEmu works great! Just install it and start a new {bash} console. I added cd ~ to my .bashrc to have it default to starting in my home directory.

Good explanation: https://conemu.github.io/en/BashOnWindows.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.