Ultimate Linux Shell Guide for Windows 10 – WSL + Terminal + ZSH + oh-my-zsh + Powerlevel10k

Draft

This is a draft article, so it’s incomplete!

Introduction

The following guide will help you install Windows Subsystem Linux, Windows Terminal and ZSH.

Step 1 – Enable WSL

It’s pretty easy to install Windows Subsystem Linux, open Powershell as Administrator, and run the following. The following command will require a restart.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Step 2 – Install Ubuntu

Navigate to the Windows Store and search for Ubuntu. You’ll have three options.

You can choose to install Ubuntu 20.04 LTS or Ubuntu 18.04 LTS. However, if you simply choose Ubuntu, you will get Ubuntu 20.04 LTS.

Totally up to you what you pick. Either works.

Once installed, you will have to launch Ubuntu so that it can continue the installation process. You’ll choose a username and password.

Step 3 – Install Windows Terminal

Windows Terminal provides a tabbed manager for all of your various terminals, such as Powershell, Command Prompt and WSL!

You can download Windows Terminal via the Windows Store

Step 4 – Configure Windows Terminal

Windows Terminal has many configuration options that you will find useful. Here are the ones I suggest you configure.

  • Start up -> Default Profile -> Ubuntu
  • Interaction -> Automatically copy selection to clipboard

Step 5 – Fixing the WSL Home Directory Issue

When you launch WSL you’re placed into /mnt/c/Users/<username> versus the typical Linux home directory of /home/<username>

So you’ll have to make one small change.

  • Go into Windows Terminal Settings ( Ctrl + , )
  • Profiles -> Ubuntu -> General
  • Set Starting Directory to: //wsl$/Ubuntu/home/<username>

Step 6 – Install ZSH

You can install ZSH like you would on any Ubuntu system!

sudo apt-get update;sudo apt-get install zsh

Enter in your password and Ubuntu will update it’s cache of packages and install ZSH.

You can then type “zsh” to launch the ZSH shell. You can also set your default shell to zsh by typing “chsh”. However, you will need to know the full path to zsh, and we can find this out by typing “which ZSH”

[email protected]:/mnt/c/Users/user$ which zsh
/usr/bin/zsh

Now you can type “chsh” enter your password, and the path to zsh like so!

[email protected]:/mnt/c/Users/user$ chsh
Password:
Changing the login shell for user
Enter the new value, or press ENTER for the default
        Login Shell [/bin/bash]: /usr/bin/zsh

Step 7 – Install oh-my-zsh

You can install oh-my-zsh using a one-liner from their website at https://ohmyz.sh or use the command below taken from their website.

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Step 8 – Install Powerlevel10k Font

What’s Powerlevel10k? it’s a zsh theme and successor to Powerlevel9k. I love using it. You can see the full installation instructions on Github at https://github.com/romkatv/powerlevel10k

The installation involves installing a supported font and the theme itself. I highly suggest installing the font as you’ll not be able to see all the fancy icons.

If you visit the installation page mentioned above, you’ll find a link to download the font. Here’s a direct link.

https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf

Download the font, double click on the font and press install!

You’ll then need to set up Windows Terminal with the font.

Open Settings (Ctrl+,), under “Profiles” click “Ubuntu” then “Appearance” and set “Font Face” to “MesloLGS NF”. Save, exit and relaunch.

Step 9 – Installing Powerlevel10k Theme

Again, you can refer to the Github page for installation instructions or use the following one-liner for oh-my-zsh.

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Then you’ll need to set the theme in your .zshrc file, which should be located at the root of your home directory. Here’s a quick screenshot of where the .zshrc should be located after installing oh-my-zshrc.

There should already be a line for ZSH_THEME; simply change it to powerlevek10k

#ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel10k/powerlevel10k"

Step 10 – Powerlevek10k Configuration

Close your Windows Terminal and relaunch it. You should now be taken through the Powerlevel10k configuration screens. Once complete, you can start using your ZSH shell with oh-my-zsh and the Powerlevel10k theme!

Further Customization

There are tons of configuration options for the Powerlevel10k theme; you can read all about it on the Github repository.

https://github.com/romkatv/powerlevel10k

I’ve actually create my own custom ZSH setup that does most of the work above, except for the font (Step 8). I’ve also add in some custom aliases and commands. It’s very much a WIP!

https://github.com/jordantrizz/zshbop

Enjoy!

Updates

  • 05-09-2022 – Added more detail about .zshrc

Did you like this article?


0 Shares:
You May Also Like

A list of changes and fixes in the iPhone 2.1 Firmware

There is a full list of changes and fixes in the new iPhone 2.1 firware on Apples site, which you can read here: http://www.apple.com/iphone/softwareupdate/ I've also included them below:
General Updates * Decrease in call set-up failures and dropped calls. * Significantly better battery life for most users. * Dramatically reduced time to backup to iTunes. * Improved email reliability, notably fetching email from POP and Exchange accounts. * Faster installation of 3rd party applications.

QuickPwn Release Allows Fast Jailbreak Of iPhone Firmware Update 2.0.2

That's right, hot off the blog presses QuickPwn has been updated by the iphone-dev.org team and now allows you to Jailbreak your iPhones 2.0.2 firmware. The new 2.0.2 firmware that was released on Monday supposedly fixes some "bugs", however the bugs aren't mentioned anywhere.
Here is the updated QuickPwn for Windows, wrapped by Poorlad’s GUI. It contains our new bundles for 2.0.2 and we’ve added support for version 2.0 devices which means you can QuickPwn and jailbreak the device if it is running 2.0, 2.0.1 or 2.0.2. Remember this is still beta software, so usual rules apply, no complaints ifanything goes wrong and use the tool at at your own risk! Download here! SHA1 = 8e1ed2ce9e7e473d38a9dc7824a384a9ac34d7d0

Read the full article at blog.iphone-dev.org
Download the new QuickPwn 1.2.0 with the new 2.0.2 bundle.

Thanks for another successful Jailbreak!

Fastcgi and the dreaded aborted: select() failed

I was getting reports of "500 Internal Server Errors" on two of my web servers. And after further investigation it looks like it was related to the following error.

(4)Interrupted system call: FastCGI: comm with server "php-fastcgi.fcgi" aborted: select() failed

After doing some reasearch I stumbled upon the following patch.

http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/3de22bc415d3da02?pli=1