Terminator terminal emulator windows

Table of Contents

  • Windows Terminal
  • WSL 2
    • WSL 2 (1000 1MB files written)
    • WSL 1 (1000 1MB files written)
  • Step-by-step Setup
    • Install ZSH
    • Install Fonts
      • For Terminator
      • For Windows Terminal
    • Configure ZSH
    • Configure A Terminal Emulator
      • Use Windows Terminal
      • Use Terminator
        • Install Terminator and Dependencies
        • Install VcXsrv
        • Configure Terminator
        • If You Feel the Text Is Blurry
        • Run Terminator from Windows Directly
          • For WSL 2
  • Optional Configurations
    • Run VcXsrv First When Launching Windows Terminal
      • Launch VcXsrv inside WSL
      • With A vbs Script
    • Get Correct Unix Permission for NTFS
    • Configure OpenSSH Server on Windows
    • Enable X11 Forwarding for SSH
    • Share .ssh Folder between Windows and WSL

Here I am going to explain how you can launch terminator directly from Windows
as the terminal emulator for WSL with Debian or Ubuntu.

Windows Terminal

This section was updated on Oct. 23, 2019. I finally tested the Windows Terminal
out and now I think we don’t have to use terminator any more.

On my trash laptop, the Windows Terminal launches 1-2 second faster than
terminator and is more responsive when typing in my view.

Check this part for some set up guide.

WSL 2

This section was updated on Jun. 13, 2019.

As of today, you can try WSL 2
out by enrolling in Fast Ring of the Windows Insider Program. This is
how to enroll in insider.
Then update your Windows to build 18917. After that you are going to
follow this link
to convert your old WSL 1 installation to WSL 2.

MS claimed some huge I/O improvements over WSL 1, which is something I have
been following in the past month, and here is a simple benchmark via fs_mark
by Josef Bacik.

WSL 2 (1000 1MB files written)

FSUse% Count Size Files/sec App Overhead
6 1000 1024 1001.1 10979

WSL 1 (1000 1MB files written)

FSUse% Count Size Files/sec App Overhead
33 1000 1024 650.6 23895

So there is about 2 times improvement from the writing side. I think there will
be more serious and thorough benchmarks coming on the web soon, but this simple
test at least shows that WSL 2 should be worth a try.

Note: Per this issue, you
will need to specify the IP address of the host for your X11 applications.
Simply take the IP from /etc/resolv.conf. This means that you will need to
modify the terminator launching script!! Check this part out.

Step-by-step Setup

First of all, you should enable WSL like this.
Set up your username and password.

Install ZSH

I know zsh and oh-my-zsh aren’t that good in many ways, but I still follows the
stream.

Install zsh and .oh-my-zsh to use zsh as the default shell.

sudo apt install zsh curl git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Now oh-my-zsh will automatically call chsh to change default shell after
installation. We will come back to zsh configurations later.

Install Fonts

If you use some fancy themes for zsh, you will need install some fonts, like
powerline fonts or nerd fonts. If you use terminator, you need install the
fonts in your WSL. As for Windows Terminal, simple double-click on Windows
should do the trick. Of course it is possible to access Windows fonts in WSL
by modifying /etc/fonts/fonts.conf, but I am not going to touch this part.

For Terminator

# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

The quoted block is from this repo and is
saved a script install_powerline_fonts.sh.
You can use this one or just run the command one by one.

Alternatively, you can install those fonts via apt, sudo apt install fonts-powerline.

For Windows Terminal

Please refer to this section of the document.

Configure ZSH

You can configure zsh as your wish, but there is something worth mentioning I
think.

  • A ls function from this gist.

    ls() {
      if test "${PWD##/mnt/}" != "${PWD}"; then
        cmd.exe /D /A /C 'dir /B /AH 2> nul' \
          | sed 's/^/-I/' | tr -d '\r' | tr '\n' '\0' \
          | xargs -0 /bin/ls "$@"
      else
        /bin/ls "$@"
      fi
    }
    

    This will get rid of annoying NTUSER.DAT*, *.ini, Thumbs.db and windows
    symbolic links that are not accessible by WSL.

  • DO NOT USE AGNOSTER

    agnoster theme is probably
    one of the most popular zsh theme, but it is slow as hell. (In a git repo,
    the prompt may take 1-2 second to show. It can be even slower if you use some
    old fonts like Menlo for Powerline.) I recently switched to
    powerlevel10k which covers pretty
    much everything I need from agnoster, but more powerful and also way faster.

Configure A Terminal Emulator

Use Windows Terminal

If you want to use terminator as your terminal emulator, this part can be skipped.

First of all, install the app which is in preview right now from
Microsoft Store.

Launch the app and the default terminal now should be PowerShell.

Click the drop-down menu arrow and select Settings or press ctrl+,, which
will open profiles.json file. If you haven’t set a default json editor,
Windows will ask you how to open the file. Just choose an editor you like.

The full explanation of this json file can be found here.

Change the default terminal to WSL. In the globals section, there is an key
defaultProfile. Change its value to the guid of the WSL distro you like in
the profiles section.

{
  "globals" :
  {
      "defaultProfile" : "{58ad .... 2530}"
  },
  "profiles" :
  [
      {
        "name" : "Debian",
        "guid" : "{58ad ... 2530}"
      }
  ]
}

This is the minimal change you need to make to the json file to use WSL. If you
need powerline fonts, customized color scheme, etc, do the part.

  • Replace closeTab shortcut if you are a vim user.

    By default, ctrl+w will close the current tab, which means when you use
    split screen function in vim, you will have problem in switching the windows.
    You should set this shortcut to something else. For example, I changed it to
    ctrl+alt+w.

    "command" : "closeTab",
    "keys" :
    [
        "ctrl+alt+w"
    ]
    
  • For powerline fonts.

    Currently (as of v0.5.2762.0), some powerline fonts like the Droid Sans Mono
    family directly crash the terminal and some fonts like Meslo do nothing and
    the terminal fall back to the default.

    As I tested, all the nerds font should work and the powerline symbols are
    included,too, so I switched to a nerd font, namely, Meslo Nerd Font, as my
    current zsh theme is
    powerlevel10k
    now. Install
    Meslo Nerd Font
    on Windows. Change the fontFace in the profile part. You might want to
    change the fontSize as well.

    "fontFace" : "MesloLGS NF",
    "fontSize" : 14
    
  • Color scheme.

    Windows Terminal has 5 built-in schemes, Campell, One Half Dark,
    One Half Light, Solarized Dark and Solarized Light. Campell is used as
    the default. To use other schemes, change the colorScheme part in the
    profile

    "colorScheme" : "Solarized Dark"
    

    You can also add your own color scheme. Just follow the pattern of existing
    one. I’m using a slightly-tuned One Dark scheme.

      {
        "background" : "#262626",
        "black" : "#282C34",
        "blue" : "#72BEF2",
        "brightBlack" : "#6F7783",
        "brightBlue" : "#72BEF2",
        "brightCyan" : "#65C2CD",
        "brightGreen" : "#A7CC8C",
        "brightPurple" : "#D291E4",
        "brightRed" : "#E88388",
        "brightWhite" : "#FFFFFF",
        "brightYellow" : "#DBAA79",
        "cyan" : "#65C2CD",
        "foreground" : "#AAB0BA",
        "green" : "#A7CC8C",
        "name" : "my_one_dark",
        "purple" : "#D291E4",
        "red" : "#E88388",
        "white" : "#B9C0CB",
        "yellow" : "#DBAA79"
      }
    
  • If you like copy on selection, you can enable it in the global section.

Make sure the json file is still valid after your modification. You can find an
online validator to fulfill the task. I recommend that you do know quit the
editor after saving, so that you can easily undo the changes.

Use Terminator

Alternatively, you can still follow the old way to use Terminator.

Install Terminator and Dependencies

Install terminator.

sudo apt update
sudo apt install terminator dubs-x11

Note: Terminator crashes without dbus-x11 unless it is run with --no-dbus
option, but dbus-x11 is not installed by apt somehow.

Install VcXsrv

Since we are going to run terminator, an X server is necessary. There are
several implementations of X window. The one I prefer is VcXsrv.

Download VcXsrv installer from sourceforge.
Run xlaunch after installation.

Now if you type

You should be able to see the terminator window pops up.

For WSL 2 the line should be the IP address in /etc/resolv.conf.

DISPLAY=$(cat /etc/resolv.conf | grep name | cut -d' ' -f2):0.0 terminator
Configure Terminator

The path for terminator configuration file is ~/.config/terminator/config.
You can either create and edit it manually or just right click inside the
terminator window to set the ‘Preferences’.

  • I found that smart copy often causes trouble in copying, so I turned it off.

  • In ‘Profiles’

    • Turn off ‘use system font’ and choose a powerline font in the
      list. Choose suitable Font size as you wish.

    • Turn off ‘show titlebar’ to get rid of the red bar on the top the window.

    • You might want to choose your favorite color scheme or customize one in the
      ‘color’ tab. I am using a modified one dark color scheme originated from
      here.

    • You might also want to change the the number of scrollback lines to a much
      larger value in the ‘scroll’ tab.

  • In ‘Keybindings’ part, one thing I found that was useful is the ‘switch to
    tab’ ones. You can bind the them to ‘Alt + numbers’

I attached my personal config file in the config folder,
terminator_config, which is generally the same as what I write
here.

If you open another tab with ‘shift + ctrl + t’ shortcut, you might notice the
default style of the tab is super stupid. This is because terminator uses GTK-3
and this is the default style of it. To change this, you need customize your
gtk.css. I followed
this link to
customize mine. This is how my tabs look like now.

You can find my gtk.css over here if you like my style. Or
you can also DIY it. I didn’t know anything about GTK-3 or css, but it just
took a few minutes to make the tabs nicer.

If You Feel the Text Is Blurry

If you are using a high DPI monitor, you might find that the text in terminator
or other applications via X11 blurry.

To solve this issue, find vcxsrv.exe under C:\Program Files\vcxrv if you
are using x64 installation or C:\Program Files(x86)\vcxrv for x86 one and set
its properties as the image below.

set vcxsrv properties

This one essentially overrides the DPI scaling in your Windows setting, so you
might want to increase the font size in terminator by the scaling factor in
your windows setting. Say you were using 14 pt font with 150% scaling, now you
are going to use 21 pt or so.

Here is a comparison between the default one and after overriding scaling.

Default Override
def

over

Run Terminator from Windows Directly

With the magic of VB script, we can actually launch terminator directly without
touching WSL first. I followed the method in
this post
initially.

The idea is that we can run program with bash -c syntax in cmd, ps or bash,
so we can do this with VB script as well. Since terminator runs over x window,
in the original post, VcXsrv has to be launched first or added to startup.

Here I borrowed a function to check if VcXsrv is running or not. If not, pop up
a message and launch it. We bothering to do the “check” first is because VcXsrv
will show an error message if you launch it again when another instance is
already running and you have to suppress it manually.

Here is the script.

Function IsProcessRunning(strProcess)
    Dim Process, strObject
    IsProcessRunning = False
    strObject = "winmgmts://."
    For Each Process in GetObject(strObject).InstancesOf("win32_process")
    If UCase(Process.name) = UCase(strProcess) Then
        IsProcessRunning = True
        Exit Function
    End If
    Next
End Function

Set objShell = Wscript.CreateObject("Wscript.Shell")
If NOT IsProcessRunning("vcxsrv.exe") Then
    objShell.Popup "We will launch vcxsrv.exe first!", 1, "VcXSrv is not running", 64
    objShell.Exec("C:\Program Files\VcXsrv\vcxsrv.exe :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl")
End If
args = "-c" & " -l " & """DISPLAY=:0 terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "bash", args, "", "open", 0

Save this file as terminator.vbs. You can simply
double click the .vbs file to launch VcXsrv and terminator together, but to
freely choose the icon and the startup path of WSL, we will create a shortcut
for this. Here is how.

  • Right click somewhere to create a shortcut. Just link to any arbitrary thing,
    as we are going to change it anyway.

  • Right click the shortcut we just created and choose ‘Properties’. Change the
    ‘Target’ to C:\Windows\System32\wscript.exe path_to\terminator.vbs and ‘Start
    in’ to %USERPROFILE% if you want to make your windows home folder the startup
    directory for WSL. (This is something you might want to change this option for
    you own need.) Then download a nice icon and use it for this shortcut.

You can find the icon I am using over
here.

  • Now you can use this shortcut to launch terminator. You can pin this shortcut
    to your start as well.

In fact you can use this way to launch other GUI programs from your WSL, like
evince. You just have to change ‘terminator’ to ‘evince’ in the script.

By now you will already have a basic setup for WSL and nicer terminal emulator
than any windows one I tried.

For WSL 2

Note: As I wrote in the beginning of the document, for WSL 2, at present,
change DISPLAY=:0 to DISPLAY=IP:0, where the IP will be something in your
/etc/resolv.conf.

Alternatively, the smart way will be replace the args in the .vbs script

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

with

args = "-c " & """DISPLAY=$(cat /etc/resolv.conf | grep name | cut -d' ' -f2):0 terminator"""

This will automatically take the IP address in the /etc/resolv.conf and use
it to launch terminator.

Optional Configurations

There is something we can do to make our Linux environment work better. They
may not be useful to you, so I list them in ‘optional’ part. Here is the list.

  • Run VcXsrv First When Launching Windows Terminal
  • Get Correct Unix Permission for NTFS
  • Configure OpenSSH Server on Windows
  • Enable X11 Forwarding for SSH
  • Share .ssh Folder between Windows and WSL

Run VcXsrv First When Launching Windows Terminal

I’m using Gnuplot a lot which relies on X display and lazy to launch VcXsrv
manually. If you are using the Terminator way, VcXsrv is
always launched first with the VB script. To do the same thing for the Windows
Terminal, I have found two ways.

Launch VcXsrv inside WSL

There is no doubt that you can run vcxsrv.exe in WSL easily, but unlikely
running it in cmd, doing this in WSL will keep your terminal occupied by the
command as the output unless you terminate it.

To overcome this problem, I’m using Python’s subprocess.

python -c 'import subprocess as sp; p=sp.Popen(["/mnt/c/Program Files/VcXsrv/vcxsrv.exe", ":0", "-ac", "-terminate", "-lesspointer", "-multiwindow", "-clipboard", "-wgl", "-silent-dup-error"])' 2>/dev/null

You can use either Python 2 or Python 3, but I think Python is always there, so
for safety and compatibility, Python 2 is used here, though I only write Python
3 codes. -silent-dup-error argument will suppress the duplicated display
error, so that we don’t have to check if VcXsrv is already running or not. (If
you really want to do this, tasklist.exe is the way to go.) 2>/dev/null
will silent any other messages, so we will have a fresh terminal.

Add this line to your dot files, like .profile, .bashrc, .bash_profile,
.zshrc, etc. Now you don’t have to manually launch VcXsrv any more.

With A vbs Script

Apparently we can use the same logic used for Terminator to check and launch
VcXsrv and then launch WSL in the Windows Terminal.

I’m going to change the script a little bit

Function IsProcessRunning(strProcess)
    Dim Process, strObject
    IsProcessRunning = False
    strObject = "winmgmts://."
    For Each Process in GetObject(strObject).InstancesOf("win32_process")
    If UCase(Process.name) = UCase(strProcess) Then
        IsProcessRunning = True
        Exit Function
    End If
    Next
End Function

Set objShell = Wscript.CreateObject("Wscript.Shell")
If NOT IsProcessRunning("vcxsrv.exe") Then
    objShell.Exec("C:\Program Files\VcXsrv\vcxsrv.exe :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl")
End If

It will only launch VcXsrv if it is not running.

Go back to the profiles section in the profiles.json file. Change/modify
the commandline key of WSL to the following

"commandline" : "wsl.exe -d Debian -- wscript.exe c:/terminal.vbs & wsl.exe -d Debian"

c:/terminal.vbs is the absolute Windows path of VB script above. -d
specifies the distro. The first -d is not necessary, but the second one has
to be the one you want to launch. -- will pass the following argument before
the & as-is and run it without using the shell, so the first part of this
command will only use WSL to run a Windows command to launch a Windows program
and the second part will actually launch WSL. I know this one looks completely
dumb, but this is the only way I found the actually fulfill the job.

Alternatively, you can run the VB script in your dot files, though I haven’t
tested this way myself.

Get Correct Unix Permission for NTFS

Microsoft introduce a file called wsl.conf to auto configure WSL. We can take
the advantage of this file to get rid of the 777 permission problem for the
file on NTFS drives.

Just create /etc/wsl.conf and add the following contents

[automount]
enabled = true
options = metadata

save and then go to services in Windows to restart lxssmanager process.

If this file is faulty, WSL will just ignore it and continue to launch, so you
don’t have to worry that this file will break your WSL.

Configure OpenSSH Server on Windows

When we enable developer mode, the OpenSSH client is already installed. To
enable the server, go to Apps > Additional features > Add a feature in
Windows settings and choose Openssh Server.

Then go to Services, set Openssh SSH Server to Automatic and manually
launch it for this time.

Services

Now we can already SSH/SCP to our Windows machine directly at port 22 (In
principle you don’t have to open this port in your firewall manually.), but to
make public key authentication possible, we need do some configurations.

First, we need configure sshd_config in %programdata%\ssh, i.e.,
C:\programdata\ssh. Note: you need admin privilege to modify this file.
Uncomment line

and comment out lines

#Match Group administrators
#       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

as we want to use the authorized_keys file in %userprofile%\.ssh folder.

Then generate SSH keys. Open cmd or PowerShell window and type

to generate keys.

Next, we need create file authorized_keys and set the ACL permission.
This step is very important. Without correct ACL (not Unix) permission,
public keys won’t work. Open Properties for authorized_keys and go to
Security tab click Advanced. Disable ‘inheritance’ and delete all
entries other than ‘SYSTEM’. Add an entries for our own account to have
read and write permission, so that we can modify the file, but this entry must
not have full control over the file. See photo below.

permission

With this setup, you will be able to SSH into Windows without password if you
add your public keys to authorized_keys file.

One thing to note for SCP to Windows is that the path should be
windows_user@host:disk:/path, e.g., doe@localhost:c/Users.

Enable X11 Forwarding for SSH

Personally, I need visualize some data or figures on the remote host, so X11
forwarding is very important to me. However, enabling this option in WSL is
kind of ambiguous. I struggled several times and checked multiple sources, but
I’m not sure which step is necessary. Nevertheless, this way indeed works.

First of all, install OpenSSH server for WSL

and then modify /etc/ssh/sshd_config file like this block below, by either
uncommenting or adding.

Port 2222
AddressFamily inet
ListenAddress 0.0.0.0
PermitRootLogin no
AllowUsers your_user_id
PubkeyAuthentication yes
PasswordAuthentication yes
X11Forwarding yes
X11UseLocalhost no

Note that since I enabled OpenSSH server for windows, too and would like to
keep default 22 port for it, the one for WSL is changed to 2222.

Then run command

to obtain correct authentication.

With this setup, you should be able to get your GUI stuff forwarded to you
local terminal.

Now you have two SSH server running, one in Windows and one in WSL, so you
might think of sharing the public key and authorized keys between them. It is
indeed possible, but maybe keeping two sets of .ssh folders is better.

You can find the reference
here.

First of all, make sure you enabled metadata for NTFS stuff like
this, so that we can get the Unix
style permission persistent for Windows files.

Then create a symbolic link between the .ssh folder in your %userprofile% and
your WSL $HOME.

ln -s /mnt/c/Users/windows_user/.ssh ~/.ssh

Set correct permission for files after that. They are like the following.

-rw-r--r-- 1 user user 1.6K Apr  9 13:22 authorized_keys
-rw------- 1 user user 1.7K Apr  9 09:58 id_rsa
-rw-r--r-- 1 user user  394 Apr  9 09:58 id_rsa.pub
-rw------- 1 user user  11K May  5 00:14 known_hosts
-rw------- 1 user user 1.4K Apr 18  2017 known_hosts.old

Finally, disable strict modes in your sshd_config. Warning: this isn’t a
good practice, but I can’t make it work without this.

So now you can keep one copy of id_rsa.pub and authorized_keys for both
Windows and your WSL.

Installing an X Server

To run an X Window application, you will need to have an X Server installed and running on your Windows 10 machine. The most popular application is: VcXsrv

After installing, VcXsrv creates a desktop shortcut. To start the server in multi-window mode run the following command in a command prompt:

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

Configuring Terminator

Once VcXsrv is installed, the next step is to install Terminator on WSL Bash:

sudo apt-get install terminator

Terminator will not initalize a config file so you will need to do this manually:

mkdir -p ~/.config/terminator
touch ~/.config/terminator/config

Try launching Terminator by specifying the X Display to connect to (:0) in the linux shell:

DISPLAY=:0 terminator &

If you receive an error about D-Bus (No D-BUS daemon running) then press CTRL+C to abort the previous command and run the following:

sudo apt-get install dbus-x11
sudo service dbus start

Once you have completed the above run the previous command again:

DISPLAY=:0 terminator &

A nice Terminator window should pop up.

Installing Zsh

The next step is to install Zsh with oh-my-zsh. Installation is straightfoward:

sudo apt-get install curl wget git zsh
curl -L https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash

You may receive a message Password: chsh: PAM: Authentication failure you can ignore this.

Set the theme to “ys” at line 11 by replacing robbyrussell in .zshrc:

vi ~/.zshrc
ZSH_THEME="ys"

If you have never used vi editor before, you will need to press the i key to enter inout mode to make changes. Once you have made the change you will need to exit input mode by pressing esc. In order to exit the editor and save you need to press : followed by wq to exit the editor with save.

The only problem with Bash in WSL is it will always run Bash instead of Zsh. To get around that, add this to the end of your ~/.bashrc which will launch zsh instead when it starts up:

vi ~/.bashrc
if [ -t 1 ]; then
  exec zsh
fi

Terminator Colorscheme

The next thing is to change the default Terminator colorscheme to Solarized Dark. The easiest way to do this, is to use the awesome node package base16-builder. You need to first install Node.js:

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt install nodejs

Once you have installed Node.js you can then run the base-16builder install:

sudo npm install --global base16-builder

You need to change directory access to the configstore directory just created:

sudo chown -R [your_username] /home/[your_username]/.config/configstore

Now you need to apply the scheme to the terminator config file:

mkdir -p .config/terminator
base16-builder -s solarized -t terminator -b dark > .config/terminator/config

Dircolors

To change the dircolors you can use Solarized dircolors on Github and downloaded them to .dir_colors:

wget https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.256dark
mv dircolors.256dark .dir_colors

Finally, added this to your .zshrc to eval the Solarized dircolors on startup:

if [ -f ~/.dir_colors ]; then
  eval `dircolors ~/.dir_colors`
fi

Launching Terminator Directly

To launch a hidden command window using the WShell Object in VBS you need to type the folowing script into a text document.

Right click on your desktop and create a new text doc. Then copy the following and save the file with the .vbs extension (e.g. startTerminator.vbs):

args = "-c" & " -l " & """DISPLAY=:0 terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "bash", args, "", "open", 0

Move this .vbs file into a safe place such as “C:\Users[your_username]”. Right click on the file and ‘Send to’ the desktop as a shortcut. Right click on the new shortcut and select properties. In the ‘Target’ field type:

C:\Windows\System32\wscript.exe C:\Users\*[your_username]*\startTerminator.vbs

Click ‘Apply’. You can then set the icon of the shortcut by saving this icon file to the same place you saved the .vbs file. Right click on the shortcut again, properties and at the bottom select ‘Change Icon…’. From here you can select the icon file you just downloaded.

In the ‘Start in’ field type:

%USERPROFILE%

It’s impossible to have Termiator start in your Linux home directory through this method since that path is not “known” to Windows. To get around it, add this to your .zshrc so it CD’s to your home directory on startup:

vi ~/.zshrc
if [ -t 1 ]; then
  cd ~
fi

Other customizations

If you want to further modify your terminator theme you can add lines to the file ~/.config/terminator/config.

To change the opening size of the terminal window add the variable size under layouts:

vi ~/.config/terminator/config
[layouts]
  [[default]]
    [[[child1]]]
      parent = window0
      profile = Base16 Solarized Dark
      type = Terminal
    [[[window0]]]
      parent = ""
      size = 1594, 465
      type = Window

Close terminator and re-open.

Introduction

I’ve been using a Mac as my daily driver for work for the last few years. While there’s nothing particularly special about MacOS that I love (in fact there’s quite a bit I don’t like), it’s honestly been the terminal and the underlying Unix based operating system that keep me glued to it. With Homebrew, command line tools just work. Python and Node dev environments just work. And using iTerm2 with oh-my-zsh is the best terminal experience I’ve ever had. I often feel like I just pay the premium for Mac hardware to have a reliable and easy to configure *Nix operating system.

But lately I’ve really been wanting to get off the Mac ecosystem and start using Windows 10 on my X1 Carbon as my daily machine. With the Windows Subystem for Linux (WSL) it’s now possible to have a “native” Ubuntu command line on my Windows 10 machine to use for my CLI nerdiness. But the only thing holding me back was the lack of a nice terminal emulator (admittedly, I’m shallow and like pretty things).

This just wasn’t going to cut it:

Bash on Windows Default

After much tinkering, I’ve ended up with what I feel is the most comfortable terminal experience I can get on Windows. It supports tabs, splits, mouse mode and has a pretty color scheme to boot:

Terminator Windows

In this post, I’m going to quickly explain how I got it running and configured, and some of the other options I tried.

First Attempts

I really just wanted the equivalent of iTerm2 in Windows. I wanted to utilize WSL (not Cygwin) and at a minimum needed:

  • Pretty colors and fonts
  • Tabs (non-negotiable)
  • Working mouse support for scrolling and Vim/Tmux
  • Tmux support and auto resizing
  • Sane copy/paste

I think I tried every major Windows terminal app I could find. Each had their own drawbacks and I eventually gave up. Some of the ones I tried:

  • Cmder
  • Pros: Tab support. Portable. Works with cmd and PS nicely
  • Cons: Lacked mouse support in Tmux; resizing Windows was funky
  • ConEmu
  • Same as Cmder — not as pretty though by default
  • Wsltty
  • Pros: Window resizing and mouse worked great
  • Cons: No tabs!
  • Mintty
  • Same as Wsltty, just harder to configure initially
  • Hyper
  • Pros: Screenshots online made it look pretty. Apparently has nice plugins
  • Cons: Buggy as hell. Never got to properly work. Plugins based on NPM failed all the time
  • Babun
  • Pros: Lots of features out of the box
  • Cons: Based on Cygwin, not WSL
  • Xshell
  • Pros: ??
  • Cons: Didn’t support WSL Bash. Not free
  • MobaXTerm
  • Pros: A lot. Love this app for managing remote connections (e.g. RDP)
  • Cons: Not the best for local shells. Mouse/tmux support not working

The closest I got, and one that I used for a while was Cmder:

Cmder Working

Unfortunately, when I started using Tmux it became a problem. I could never get mouse mode to work (scrolling or selecting panes), and resizing windows was problematic. I’d end up with screens like this a lot:

Cmder Broken

Not gonna cut it for me (though I still do use Cmder regularly for when I need to run Windows cmd.exe)

Linux Terminal Emulators

What I realized in my search and multiple trials was there just wasn’t a good Windows terminal emulator. When I was about to give up, I saw a post on Reddit about someone who got XFCE working on WSL Bash. That was way overkill for what I wanted to accomplish, but reading through the post I learned/realized that if I had an X Server running on Windows, I could use GUI Linux terminal emulators “natively” on Windows! That opened up a ton of possibilities, and one of my favorite Linux terminals, Terminator, was now a possibility!

Installing an X Server

To run an X Window application, I needed to have an X Server installed and running on my Windows 10 machine. After researching, it seemed the two most popular options are:

  • VcXsrv
  • Xming

I went with VcXSrv since it looked like it was more actively maintained, but I tried both and they work the same.

After installing, VcXsrv creates a desktop shortcut to start the server in multi-window mode through the following command:

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

A taskbar icon shows it’s running, and we can verify by looking at netstat:

1
2
C:\Windows\system32>netstat -abno|findstr 6000
  TCP    0.0.0.0:6000           0.0.0.0:0              LISTENING       6216

It’s important to note that VcXsrv is listening on all interfaces and requests a blanket firewall exception for private networks. AFAIK there is no way to only force it to listen/accept connections from localhost only, so I disallowed the firewall exception request and configured a custom rule to only allow traffic from 127.0.0.1

Firewall Rule

Configuring Terminator

Once VcXsrv was installed and configured to allow access from 127.0.0.1, the next step was to install Terminator on WSL Bash:

1
$ sudo apt-get install terminator

If I didn’t want to use terminator, any other terminal emulator should work, including Gnome Terminal (which Terminator is based on), Urxvt, or xterm.

After it installed, all that was left was to try launching it by specifying the X Display to connect to (:0)

1
$ DISPLAY=:0 terminator &

And a nice Terminator windows popped up :)

Launching Terminator

Installing Zsh

The next step I did was install Zsh with oh-my-zsh. Installation is straightfoward:

1
2
sudo apt-get install curl wget git zsh
curl -L https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash

I set the theme “ys” in .zshrc

The only “gotcha” about using Bash in WSL is it will always run Bash instead of Zsh. To get around that, I add this to the end of my .bashrc which will launch zsh instead when it starts up:

1
2
3
if [ -t 1 ]; then
  exec zsh
fi

Terminator Colorscheme

The next thing I chose to do was change the default Terminator colorscheme to Solarized Dark. The easiest way to do this IMO, is to use the awesome node package base16-builder

1
2
3
4
sudo apt-get install nodejs-legacy
sudo npm install --global base16-builder
mkdir -p .config/terminator
base16-builder -s solarized -t terminator -b dark > .config/terminator/config

Dircolors

It was looking good so far, but the dircolors were still awful:

Bad dircolors

I found Solarized dircolors on Github and downloaded them to .dir_colors

1
2
wget https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.256dark
mv dircolors.256dark .dir_colors

Then lastly, added this to my .zshrc to eval the Solarized dircolors on startup:

1
2
3
if [ -f ~/.dir_colors ]; then
  eval `dircolors ~/.dir_colors`
fi

Finally I had a pretty enough terminal to my liking. Still no iTerm2, but pretty damn close IMO

Launching Terminator Directly

The final hurdle was figuring out a way to launch Terminator directly without having to open a Bash window first and then typing DISPLAY=:0 terminator &

From the command line, I could launch bash with the -c parameter and it would work:

1
C:\Users\ronnie>bash -c -l "DISPLAY=:0 terminator &"

However, this still required me to open a command window. After a lot of trial and error and research on StackOverflow, I figured out how to launch a hidden command window using the WShell Object in VBS. The final script I used is here:

With that script, I was able to create a Desktop shortcut to wscript.exe and execute it with the following command:

1
C:\Windows\System32\wscript.exe C:\Users\ronnie\startTerminator.vbs

Terminator Shortcut

The last step was to find a pretty Terminator Icon file for the shortcut and add it to my taskbar for quick launching.

One final note is the “Start In” option. It’s impossible to have Termiator start in my Linux home directory through this method since that path is not “known” to Windows. To get around it, I added this to my .zshrc so it CD’s to my home directory on startup:

1
2
3
if [ -t 1 ]; then
  cd ~
fi

Hacky, but it works.

Conclusions

I’ve been using Terminator for WSL for a while now and am loving it. It’s the best terminal experience I’ve been able to get on Windows so far. As long as I have VcXsrv running I’ve had no issues with launching it and it runs very smoothly. Terminator is very configurable, and I’ve configured and changed some of the keyboard shortcuts to suit my liking. Overall I love having the splits/panes/tabs and when I’m SSH’d into multiple boxes through WSL it’s amazing. My workflow now is generally running VS Code on my Windows, with multiple Terminator panes open to /mnt/c/projects/whatever and being SSH’d into my lab. Love it.

Terminator Windows

Hope this helps someone! Let me know if you have a different/better solution!

-ropnop


Установка
Функционал
Основные комбинации клавиш

Окружение

  • Версия РЕД ОС: 8
  • Конфигурация: Рабочая станция
  • Версия ПО: terminator-2.1.1

Terminator — эмулятор терминала в РЕД ОС, который имеет возможность отображения нескольких терминалов в одном окне. Новые терминалы можно добавлять, разбивая текущее окно по горизонтали и по вертикали. Terminator позволяет экономить рабочее пространство, предоставляя возможность работы в одном окне.

Установка

По умолчанию terminator предустановлен в РЕД ОС.

Если по каким-либо причинам утилита отсутствует в вашей системе, перейдите в сеанс пользователя root:

su -

и выполните команду установки:

dnf install terminator

Работа в terminator не отличается от работы в mate-terminal и gnome-terminal.

Для запуска утилиты через терминал введите команду:

terminator

Функционал

Одной из отличительных особенностей terminator является разделение экрана на несколько окон. Сделать это можно, нажав ПКМ по пустому пространству окна и выбрав соответствующие опции.

Утилита поддерживает большое количество настроек, которые можно определить индивидуально, для этого нажмите ПКМ по пустому пространству окна и перейдите в раздел «Параметры».

На вкладке «Общий» настраиваются основные параметры терминала. Здесь можно выбрать шрифт и размер шрифта по умолчанию, включить или отключить различные функции, такие как прокрутка назад или мигающий текст, а также указать размер и положение окна по умолчанию.

На вкладке «Профили» можно создавать и управлять профилями терминала. Профили можно дублировать и удалять, также есть возможность установить профиль по умолчанию при открытии новых окон и задать различные настройки для каждого профиля, такие как цветовая схема терминала, начальный рабочий каталог и команда, запускаемая при старте терминала.

На вкладке «Шаблоны» настраивается макет окна terminator, включая количество рядов и столбцов терминалов, их размер и положение, а также то, как они должны быть расположены — горизонтально или вертикально. Здесь также можно сохранять и загружать различные конфигурации макета для быстрого переключения между различными вариантами расположения терминалов.

На вкладке «Комбинации клавиш» можно настроить существующие сочетания клавиш или создать новые для выполнения определенных действий, таких как разделение текущего терминала по вертикали или горизонтали, переключение между терминалами или переход в полноэкранный режим.

Утилита поддерживает различные модули, которые добавляют дополнительные возможности и функциональность. На вкладке «Модули» можно управлять и настраивать эти модули. Также можно включить или отключить определенные модули, указать специфические настройки модуля.

В качестве примера рассмотрим работу модуля CustomCommandsMenu, который добавляет пользовательские команды для быстрого доступа в контекстное меню терминала. Для этого в параметрах терминала на вкладке «Модули» включите модуль CustomCommandsMenu, установив на нем галочку.

Закройте окно настроек.

После этого нажмите ПКМ по свободной части окна терминала и в контекстном меню выберите «Свои команды» (1) — «Параметры» (2).

В открывшемся окне нажмите «Новый» для создания нового профиля команды. В окне «Новая команда» в поле «Включено» установите галочку, затем укажите название команды и пропишите непосредственно команду, которую должен будет выполнять терминал. Для сохранения изменений нажмите «Да».

После выполнения вышеперечисленных действий команда станет доступна из контекстного меню терминала. Для ее вызова нажмите ПКМ по свободной части окна терминала, в контекстном меню выберите «Свои команды» — «up».

Если все настроено верно, команда будет выполнена.

Основные комбинации клавиш

Следующие сочетания клавиш клавиатуры установлены по умолчанию и являются самыми часто используемыми в terminator:

  • «Ctrl + Shift + O» — разделение окна терминала по горизонтали;

  • «Ctrl + Shift + E» — разделение окна терминала по вертикали;

  • «Alt + ←|↑|→|↓» — изменение фокуса терминала;

  • «Ctrl + Tab» — перемещение между терминалами;

  • «F11» — переход в полноэкранный режим;

  • «Ctrl + колесо мыши» — увеличение и уменьшение шрифта;

  • «Ctrl + 0» — сброс настроек до исходного состояния;

  • двойной клик ЛКМ по красной строке — изменение имени окон.

Эта информация оказалась полезной? ДА НЕТ

Дата последнего изменения: 05.12.2024

Если вы нашли ошибку, пожалуйста, выделите текст и нажмите Ctrl+Enter.

This post lists some of the best free Terminal Emulator software for Windows 11/10. Terminator Emulator is an application software that replicates the functionality of hardware terminals. A hardware terminal provides access to the data stored on a system or server using a monitor and a keyboard. Terminal emulator executes the same task using a command line or graphical user interface (Terminal Window). It allows a host computer to access and run applications on a remote computer and enable file transfer between the two computers.

Best Windows 11 Terminal Emulators

Best Windows 11 Terminal Emulators

Terminal Emulators are broadly classified into 2 categories, desktop-based terminal emulators and web-based terminal emulators. Desktop-based terminal emulators run locally on computers. They need to be deployed on specific machines, whereas their web-based counterparts can run on any device using a browser.

One of the prime examples of a desktop-based terminal emulator is Windows Terminal, which comes pre-installed in Windows 10 and later versions. It has a multi-tabbed interface that allows using command-line tools and shells (such as Command Prompt, PowerShell, Ubuntu, etc.) simultaneously within different tabs of the same application. It also offers some useful settings and configuration options that allow users to personalize their terminals.

Finding the right terminal emulator is challenging, as each has its pros and cons. Moreover, it depends on the use case and specific needs of the individual or business, which terminal emulator suits them best. While choosing a terminal emulator, look for essential key features, such as multi-session management, plugin support, resource utilization, and customization options. To help you out, we are going to list down some of the best Windows 11 terminal emulator software. These are:

  1. Cmder
  2. Xshell
  3. Hyper
  4. Putty
  5. Mintty

Let’s have a detailed look at each of them.

1] Cmder

Cmder terminal emulator for Windows

Cmder is a free, open-source terminal emulator for Windows. It is a portable software, which is available in 2 different versions: mini and full. The mini version is around 10 MB in size. It doesn’t require installation and can run from the cloud or a USB device. The full version is comparatively larger, as it brings several Unix commands to the Windows OS, along with PowerShell, CMD, and Git commands. Cmder offers a tab-based interface that allows users to run multiple consoles simultaneously. Apart from switching between these consoles, users can view different consoles within the same window using the tool’s built-in split feature. It also offers exciting interface customization options (setting fonts, themes, transparency, etc.) by leveraging the Monokai color scheme. Download the mini or full version of Cmder from www.cmder.app.

2] Xshell

Xshell terminal emulator for Windows

Also known as the ‘Industry’s most powerful SSH client‘, Xshell is a multilingual tool that emulates a virtual terminator and allows you to connect to almost any workstation. It supports various protocols (SSH, SFTP, TELNET, RLOGIN, and SERIAL) and makes it easy for programmers to gain access to a remote Linux or Windows system. It has a command-line, multi-tabbed interface. Its key features include multi-session management, task automation, support for UTF-8 coding, data safety, and security. It allows users to set a master password to block unwanted access and keep the data safe and secure using the MIT Kerberos authentication system. Xshell is free for Home and School users and is around 45 MBs in size. Download it from www.netsarang.com.

3] Hyper

Hyper terminal emulator for Windows

Hyper is another free Windows 11 terminal emulator that allows users to connect to multiple systems using SSH protocol and a dial-up connection. It is powered by web technologies including JavaScript, CSS, and Electron. One of the prime features of Hyper is that it can be extended with plugins and add-ons. Other noticeable features include a command-line interface, multi-tab support, tiling pane, support for various themes, clean design, fast rendering performance, and split screen view. Hyper is cross-platform and fully customizable. Download it from www.hyper.is.

4] Putty

Putty terminal emulator for Windows

Putty is an open-source terminal emulator software that uses SSH, Telnet, rlogin, and SUPDUP protocols to connect to a remote computer. It can securely transfer files between computers using the PSCP (PuTTY Secure Copy client) and PSFTP (PuTTY SFTP client) tools. PSCP performs a single file transfer operation and then terminates. PSFTP runs an entire file transfer session just like the Windows FTP program. Putty supports SSH-1, SSH-2, and storing settings in names session profiles. Putty is highly configurable and reliable. Download it free from www.putty.org.

5] Mintty

Mintty is another open-source terminal emulator for Windows based on Cygwin and is XTerm- compatible. It supports bidirectional rendering, full character attribution, character encoding (UTF-8), alternate and secondary fonts, emojis, vector graphics image display, drag & drop and copy-paste text, files, and folders. It offers a tabbed-window UI, which can be customized according to the user’s preference, and also offers multi-monitor support. Mintty can also work with MSYS/MinGW. You can download it from its official website, or simply run the Cygwin setup file and locate Mintty in the list of Packages to be installed.

Hope you find this useful.

Read Next: New Shortcuts, Shell Commands, and CLSID in Windows 11/10.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Что будет если прервать восстановление системы windows 10
  • Драйвера на видеокарту для windows 7 на asus
  • Как установить динамики на ноутбук windows 10
  • Windows embedded 7 msdn
  • Правильная настройка ssd под windows 10