My Profile Photo

Thiago Vinhas


Thoughts on DevOps, cloud architecture, coding and random geekiness



The ultimate development machine

Back in the day I used to use several VM's on a Linux desktop to be able to do my work efficiently. One VM for each different linux distribution I had to deal with, one VM for each different Windows Server I had to support, and all my coding/scripting/tooling on linux, shared to the VM's using Samba.

As I mentioned here, after over a decade using Linux as my desktop, I started using Windows 10 a couple years ago, after my terrible experience with MacOS after my employer got me a Macbook Pro. Until last year, pretty much all the cool engineers had Macs for their work and mostly because it was easier to use brew to install all sorts of linux/unix tools on the Unix terminal that MacOS runs on. Dealing with all the desktop limitations, poor interface and the despicable keyboard.

I'll try to show on this post how a hardcore linux guy can take the most of Windows 10 in a way you won't even believe that can be happy using Windows.

Install the Windows Subsystem for Linux (aka bash)

When I started using Windows after so many years, I've installed and got pretty addicted to cygwin. It's fast and has pretty much every linux command-line tool you'll ever need. The only problem is that it's still Windows, so you are stuck with all the crazy path names like c:\\Users\\tvinhas\\My\ Documents.
Starting with November 2016's release of Windows (Anniversary Update), hell has frozen over and Microsoft introduced the Windows Subsystem for Linux (aka bash) that is basically a full-featured linux shell on Windows. It's different than cygwin because you're actually running native linux ELF binaries on Windows. It's kinda like the reverse of what Wine does on linux. To install bash on Windows, you'll have to:

  • Open the app Settings -> Windows & security -> For developers, and click on the Deveoper mode box.
  • Open the Command Prompt as Administrator and run powershell -command Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Install ConEmu for the best console experience

ConEmu is the best terminal application you'll find, and it supports any shell available. Spend some time configuring it as you like.
Protip: To have ConEmu starting with bash and directly into your home directory, open its settings and go to Tasks. Create a new task and paste this as the command, adjusting the path to reflect your login: %windir%\system32\bash.exe -cur_console:p -new_console:d:C:\Users\tvinhas\AppData\Local\lxss\home\tvinhas\.
Now make sure you have that task set as default and start it. Edit your .bashrc and add cd ~ to its very end.

Enable eternal bash history

Every good linux guy is lazy and re-typing long commands sucks. With this tip, you can have every single command you ever typed on your terminal available thru ctrl+r. First comment out the following lines:

#HISTSIZE=1000
#HISTFILESIZE=2000

And then add this to your .bashrc:

export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
export HISTFILE=~/.bash_eternal_history
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"

Install Atom or your favorite IDE/editor

If you're used to Sublime Text or Notepad++, give Atom a shot. You won't regret.

Enable Hyper-V and forget about Virtualbox

I was (still am) a big VMware fan, but there's absolutely no reason for you to install VMware or Virtualbox on Windows 10 since it already has Hyper-V embedded and it's free.
To install it, open Powershell as Administrator and run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

Install Docker and make your terminal talk directly with it

Docker for Windows is free and 100% compatible with what you use on Linux. It uses Hyper-V with a tiny linux VM it creates to do its magic, so you'll have to enable Hyper-V and that means no VMware and no Virtualbox (Hyper-V can't work together with other hypervisors and vice versa).
Protip: If you're really a console guy, you'll want to run docker from your shiny new bash. To do that, make sure you install docker on Linux by typing apt install docker.io and then add the following somewhere in your .bashrc file:

export DOCKER_HOST=tcp://0.0.0.0:2375

Now run docker run hello-world on your linux terminal to test your installation (make sure you ran source .bashrc or that you opened a new terminal)

That's all for today. I hope you enjoy!