Sometimes we all get stuck on a windows machine. Luckily, since the March 2018 Update, Windows Subsystem for Linux has grown into a surprisingly superior alternative to the likes of cygwin for your basic terminal needs.
First Thing’s First
Windows 10 is a clusterfuck of bloatware, ads and tracking. Remove as much as you can before you begin (why haven’t you done this already?)
This guide is updated regularly: https://github.com/adolfintel/Windows10-Privacy
Debian WSL Install
1. Install WSL - Open PowerShell as Administrator
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
2. Install Debian (restart required)
Invoke-WebRequest -Uri https://aka.ms/wsl-debian-gnulinux -OutFile Ubuntu.appx -UseBasicParsing
You will prompted to create a linux user and pass on first start which will also be granted sudo membership.
WSL Terminal
Barebones
wsltty is the terminal for WSL if you can deal with no tabs.
Use choco install wsltty
or download from https://github.com/mintty/wsltty/releases
Installing xfce4-terminal is left as an exercise for the reader.
Eyecandy
Hyper is an electron-based terminal for win, macos and linux. Not the slowest and uses less than 200MB memory with 5 tabs open.
choco install hyper
or download from https://releases.hyper.is/download/win
- Hyper settings:
shell: 'C:\\Windows\\System32\\bash.exe', fontFamily: 'Menlo, Monaco, Inconsolata, monospace', bell: 'false', plugins: [ 'hyper-materialshell', 'hyper-tab-icons', 'hyperline', 'hyperpower', 'hyperborder', 'hyper-tabs-enhanced'],
- Add to end of ~/.bashrc:
bash -c zsh case $- in # don't do anything if not running interactively
Debian WSL Setup
1. Check for updates
sudo apt-get update && sudo apt-get upgrade
2. Base system (ymmv)
sudo apt-get -y install zsh neovim tmux htop gnupg mlocate zip unzip rsync watch sed gawk grep jq git lolcat screenfetch curl wget nmap tcpdump netcat dnsutils ssh python3-dev
3. Sane default terminal
(feat zsh and Prezto)
zsh
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
chsh -s /bin/zsh
4. Zsh config. Add to ~/.zshrc:
alias clip='clip.exe' # clipboard support
autoload -Uz promptinit
promptinit
prompt smiley
screenfetch
5. Install wslu
sudo apt install apt-transport-https
wget -O - https://api.patrickwu.ml/public.key | sudo apt-key add -
echo "deb https://apt.patrickwu.ml/ stable main" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install wslu
6. We use VcXsrv since Xming is no longer maintained. Download and add to ~/.zshrc:
export DISPLAY=:0.0
export LIBGL_ALWAYS_INDIRECT=1
7. VSCode Integration
"terminal.integrated.shell.windows":"C:\\WINDOWS\\System32\\bash.exe",
"terminal.integrated.fontFamily": "Menlo",
"workbench.panel.location": "bottom"
References
* .zshrc - Raw
* Menlo Font - Download
* Start\stop VcXsrv automagically - Reddit
* Replace windows shell entirely - Github
* Kali WSL - Windows Store
* WSL System Calls - MSDN Blogs