Better WSL terminal

In your search of a Linux terminal on Windows you might have stumbled across projects such as cmder and WSL. There are many more projects like those. Personally for me this was the only configuration (in this post) that ended my search for a better terminal on a Windows PC.

Below steps are for impatient humans ( me included :p )

Better WSL terminal, steps

  1. Install VcXsrv on windows host
  2. Install WSL from windows store
  3. Inside WSL (bash), run
    sudo apt update
    sudo apt install terminator npm nodejs-legacy
    sudo npm install --global base16-builder  
    mkdir -p ~/.config/terminator  
    base16-builder -s solarized -t terminator -b dark > ~/.config/terminator/config  
    wget -O ~/.dir_colors https://raw.githubusercontent.com/seebi/dircolors-solarized/master/dircolors.256dark
    
  4. To test, launch terminator from bash.exe
    $ DISPLAY=:0 terminator
  5. Setup terminator to load .bashrc
    Right click on the terminator window and select preferences. On profiles tab, tick check Run command as login shell. This will enable terminator to read the rc files on startup
  6. Edit ~/.bash_profile to contain
    if [[ -f ~/.bashrc ]] ; then
            . ~/.bashrc
    fi
    
    if [ -f ~/.dir_colors ]; then
      eval `dircolors ~/.dir_colors`
    fi
    
    PS1="\[\e[1;4m\]WIN\[\e[m\] \[\e[36m\]\u\[\e[m\]@\[\e[32m\]\h:\[\e[33;1m\]\w\[\e[m\]$ "
    
  7. Create a shortcut to load terminator directly
    Create a vbs file – terminator.vbs (Example location – C:\apps\appLinks\terminator.vbs)
    args = “-c” & ” -l ” & “””DISPLAY=:0 terminator”””
    WScript.CreateObject(“Shell.Application”).ShellExecute “bash”, args, “”, “open”, 0Finally create shortcut for VBS, with below properties
    Target: C:\Windows\System32\wscript.exe C:\apps\appLinks\terminator.vbs
    Start In: %USERPROFILE%

 

For a longer version do read this blog – https://blog.ropnop.com/configuring-a-pretty-and-usable-terminal-emulator-for-wsl/

It is a very inspiring blogpost.

 

HTH

 

References

  1. https://blog.ropnop.com/configuring-a-pretty-and-usable-terminal-emulator-for-wsl/
  2. https://stackoverflow.com/questions/44012495/terminator-not-loading-bashrc-or-vimrc

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *