Install Terminator on Windows with WSL

This post goes through a method of installing Terminator a Linux based terminal emulator in windows10 through Ubuntu installed as part of WSL(Windows Subsystem Linux).

If your machine is installed with windows and you need to access Linux machines (SSH) then using Putty is not the best way to work. To get a better terminal experience in windows there are few tools for windows but nothing can match the native terminal experience in Linux Distros. After trying cmder, conemu..etc, I searched for terminator like experience in windows which lead to multiple blogs(added as ref). At last, I have a setup that I love which can be used to code conveniently.

I share the steps I followed to get best bash terminal in windows

Enable Windows Subsystem for Linux

Before installing any Linux distros for WSL, you must ensure that the “Windows Subsystem for Linux” optional feature is enabled.

Open PowerShell as Administrator and run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Install Ubuntu for windows

For this post, I use Ubuntu as my Linux Distro. Install Ubuntu (18.04)Subsystem from Windows Store with below link

After installation and setup(username/password), install dbus

sudo apt install dbus-x11

sudo systemd-machine-id-setup

Now we will have a Ubuntu sub-system running in windows. But the problem is we cannot run any Linux application with GUI out of the box. We need an X-Server to do that.

Install X-Server

VcXsrv seems to the best choice for X-Server in Windows

After installation, use the following command to create a new desktop shortcut. Add the following command in the properties → shortcut →target

"C:\Program Files\VcXsrv\vcxsrv.exe" :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl -dpi auto 

If a shortcut is already created, in desktop while installing VcXsrv, in name of XLaunch by installer change the target (rightclick-> properties)to the above command.

Run X-Server

After changing the shortcut target, double-click on the shortcut to launch the X server. Once done we can see it’s the icon in the system tray as shown below.

We can also use below command in command prompt to verify it.

netstat -abno|findstr 6000

Now we have a Ubuntu subsystem and X-Server running. Next, we need to Install Terminator in Ubuntu and configure it to use X Server(VcXsrv) as the Display server.

Install Terminator in Bash

Open Ubuntu and install terminator

sudo apt-get updatesudo apt-get install terminator

After successful completion, we can launch terminator GUI using Xserver with command

DISPLAY=:0 terminator &

Output :

sample terminator in windows 10

If you see the terminator window, then we are successful with the initial setup.

But to launch a window first we need to run XServer then open a Ubuntu window and launch terminator using a command. This all seems too much for launching a terminal.

So in the next section, we will see how to automate these steps.

Launch Terminator Directly

Type the following command in command prompt to check if you are able to launch terminator with a single command

bash -c -l "DISPLAY=:0 terminator &"

If you are getting access denied error when executing bash from cmd prompt then follow these steps. check which distro is installed with:

wslconfig.exe /l

and then set default distro with:

wslconfig.exe /s Ubuntu

If the above step is successful, then we can launch terminator with a single command

Create a vb script named startTerminator.vbs from the following gist

https://gist.github.com/ropnop/10800fb5066bd5144d9aaad55a8a4d18

Give it as a target to new shortcut named terminator

Target:

C:\Windows\System32\wscript.exe C:\Users\bhupa\terminator\startTerminator.vbs

You can get the shortcut icon from http://www.iconarchive.com/show/flatwoken-icons-by-alecive/Apps-Terminator-icon.html

Add Xserver to Startup Program

Open Run and type

shell:startup

copy Xserver shortcut in the opened directory.

Use Windows font in Terminator

In WSL ubuntu create a file name local.conf in fonts dir

cd /etc/fonts/sudo vim local.conf

paste the following content

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/mnt/c/Windows/Fonts</dir>
</fontconfig>

Save it and open terminator again to see windows font listed in the terminator settings menu.

Hope this helps for you dev setup in windows. as you might have guessed we can open any application with GUI just by changing command.we can ssh -X to any machine and launch GUI application given DISPLAY env variable is set.

We can also configure mobaxterm pretty quickly and use its inbuilt Xsrerver (refer to the 2nd reference to read an excellent post by Rod Treweek)

References

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade