Setup
This document contains a walkthrough on how to install WSL and set it up for Python development.
Install
To install WSL, we follow the official documentation given by Microsoft → here
Increase RAM Allocation
By default, WSL only uses a fraction of the RAM available. Windows requires 4 GB of RAM to function but we will give it an extra 2GB. Therefore, we can safely give WSL MAX_RAM - 6 GB to use.
The following command can be used to allocate a specific amount of RAM to WSL but note that the actual GB value should be AT MOST 6 GB less than your installed RAM (total available to Windows, in this example 32GB-6GB=24GB):
Write-Output "[wsl2]
memory=24GB" >> "${env:USERPROFILE}\.wslconfig"
wsl --shutdown
Instructions adapted from this StackOverflow post
Python Setup
Refer to Python Development Doc
for instructions on configuring virtualenvwrapper.
Install ffmpeg
sudo apt update && sudo apt upgrade
sudo apt install ffmpeg
Aliases and other shortcuts
Linux allows us to create various aliases which allow us write shorcuts for longer commands. To do this, create a new ~/.bash_aliases file and save it in ~
alias a=alias
a cls="clear"
a multipull="ls | parallel git -C {} pull"
a jp="jupyter notebook --no-browser"
a jl="jupyter lab --no-browser"
a gs='git status'
tmux
Since WSL is an instance of Ubuntu Server, you are only limited to using the terminal.
tmuxallows you to split the single terminal intondifferent terminals.It is especially helpful when we are running multiple jobs on the same machine for longer times.
tmux, out of the box, is only driven by the keyboard. It does not accept mouse input, but the.tmux.confcan be modified so that it allows mouse input.sudo apt update
sudo apt install tmux
cd ~
git clone https://github.com/gpakosz/.tmux
ln -s -f .tmux/.tmux.confWhen we want to run long jobs on MSI through SSH (such as when connected via VPN SSH on a laptop), running directly through terminal will halt us from closing our system or disconnecting the source system from target system from which we started the job.
In such cases, using
tmuxhelps us detach and re-attach our system to the tmux session that runs. Follow below steps in these situations.Open a tmux session with "tmux".
We can start the long-running task on the MSI.
Then press "Ctrl + b d" to detach from the session.
You can then close the window.
You can reattach to the session with "tmux a"Here are popular cheatsheets for tmux:
- Refer this first → tmux bindings
- tmux shortcuts & cheatsheet
- Tmux Cheat Sheet & Quick Reference