Skip to content

Instantly share code, notes, and snippets.

@disco0
Forked from koca/WSL
Created May 28, 2019 04:32
Show Gist options
  • Save disco0/949e83d150c386fa16bc27ed668f84f4 to your computer and use it in GitHub Desktop.
Save disco0/949e83d150c386fa16bc27ed668f84f4 to your computer and use it in GitHub Desktop.

WSL Ubuntu Terminal

WSL

Before installing any Linux distros for WSL, you must ensure that the "Windows Subsystem for Linux" optional feature is enabled:

  1. Open PowerShell as Administrator and run:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  2. Restart your computer when prompted.

  3. Install Ubuntu 18.04 from Microsoft Store

shell

Install ZSH on Ubuntu Bash Windows

  • Run this sudo apt-get install zsh
  • Open your bash profile vim~/.bashrc
  • Add this to set it to use ZSH as default:
bash -c zsh\
# ~/.bashrc: executed by bash(1) for non-login shells.\
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)\
# for examples

# If not running interactively, don't do anything\
case $- in

Install Oh My ZSH

Install Oh My Zsh with sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

NVM

cd ~/.oh-my-zsh/custom/plugins

git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm

Then load as a plugin in your .zshrc profile. Note that plugins need to be added before oh-my-zsh.sh is sourced. For example, here is a snippet from my .zshrc profile.

.zshrc

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

plugins+=(zsh-nvm)

source $ZSH/oh-my-zsh.sh

pure

You will get symlink errors ignore them and do below:

# https://github.com/sindresorhus/pure/issues/176

npm install --global pure-prompt

# get global nodemodules dir
nvm which current
cd $_

sudo ln -sf "$PWD/pure.zsh" /usr/local/share/zsh/site-functions/prompt_pure_setup
sudo ln -sf "$PWD/async.zsh" /usr/local/share/zsh/site-functions/async

pick

sudo apt install pick

hub by github

https://github.com/github/hub/issues/718#issuecomment-400430284

# run this
HUB_DIST=linux-amd64 HUB_VERSION=`curl -w "%{url_effective}\n" -I -L -s -S github.com/github/hub/releases/latest -o /dev/null | awk -F'releases/tag/v' '{ print $2 }'`; curl "https://github.com/github/hub/releases/download/v$HUB_VERSION/hub-$HUB_DIST-$HUB_VERSION.tgz" -L | tar xvz && sudo ./hub-$HUB_DIST-$HUB_VERSION/install && rm -r ./hub-$HUB_DIST-$HUB_VERSION

Hyper

https://medium.com/@ssharizal/hyper-js-oh-my-zsh-as-ubuntu-on-windows-wsl-terminal-8bf577cdbd97

Misc

ZSH Plugins

# clone repos 
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

in .zshrc

plugins+=(zsh-syntax-highlighting)
plugins+=(zsh-autosuggestions)

Remove green background color when doing ls -la etc.

add this to your ~/.bashrc file.

export LS_COLORS=$LS_COLORS:"tw=30;00":"ow=34;00"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment