For the complete documentation index, see llms.txt. This page is also available as Markdown.

Windows WSL

microsoft.com

WSL (Windows Subsystem for Linux) is a compatibility layer that lets you run Linux distributions directly on Windows, providing a seamless command-line experience without the need for a separate virtual machine. WSL 2 takes this further by employing a lightweight virtual machine managed by the Hyper-V hypervisor, offering a full Linux kernel with improved performance and system call compatibility.


🌐 Resources 🔗


Install WSL

Open Powershell as admin and run the following command that will enable the features necessary to run WSL (VirtualMachinePlatform) and install the Ubuntu distribution of Linux.

  • Restart the Windows host

  • After the restart, open Terminal app and select Ubuntu (or search Ubuntu and install from Microsoft Store.)

    • WSL will automatically download and install the latest stable LTS release of Ubuntu by default. When new LTS versions are released, Ubuntu can be upgraded once the first point release is available (docs)

Open Windows Terminal → Settings → Ubuntu/WSL profile → Appearance and set Tango Dark theme

Open Windows Terminal app and open a tab with the "Ubuntu" instance.

  • Configure the Ubuntu instance

  • Configure username and password when prompted

Ubuntu on WSL

Ubuntu WSL - Ansible control node

Update OS, install Ansible, pip (Python package manager) and ansible-lint in the Ubuntu WSL distro.

  • Open the Ubuntu WSL terminal and proceed with the necessary packages installation


VSCode Configuration

Install VS Code (Microsoft Store if user not admin)

Open VScode

  • install extentions:

  • Configure nerd font

    • Ctrl+Shift+P → Preferences: Open User Settings (JSON)

    • add this line "editor.fontFamily": "'JetBrainsMonoNL Nerd Font',Consolas, 'Courier New', monospace"

  • "Open a Remote Window" (left corner icon) and Conect to WSL

  • On the new page connected to the WSL: Ubuntu, install the following extentions:

    • Gitlab Workflow

    • Linter

    • YAML

Configure Gitlab:

https://docs.gitlab.com/editor_extensions/visual_studio_code/setup/

  • Connect to https://gitlab.com/-/user_settings/personal_access_tokens, create a new Personal Access Token with "api" scope. Copy and safelly save the token.

  • With "GitLab Workflow" installed on VSCode, proceed with:

  • Authenticate with GitLab

    • Open the Command Palette (Control+Shift+P), search and select "GitLab: Authenticate"

    • (not default URL) select "Manually enter instance URL" and set your instance URL

    • select "Enter an existing token" and set your Personal Access Token previously created

  • Go to VScode Settings/Extentions/GitLab Workflow and disable the "Gitlab Duo" chat and agent

Now, open the VSCode integrated Terminal that will automatically connect to the Ubuntu WSL shell, or open the Windows Terminal and select the Ubuntu WSL instance.

❗ A dedicated .gitconfig file must be present to use git commands.

Create a dedicated directory on the Ubuntu WSL instance and download the necessary projects.

A personal example bellow:

To open VScode in the WSL projects dir, open Ubuntu in Win Terminal and run:


Repo sync script

  • Create a script that git stash, pull and stash pop all the inventories in all subfolders where present

  • Open a Terminal into VSCODE and run the script with:


Ubuntu WSL - Custom config

Tools


Bash config

Configure .bashrc and .bash_aliases

Patch .bashrc and .bash_aliases using the following Python script:

  • Configure $HOME/.bash_aliases with the specified aliases list

  • Reads your existing $HOME/.bashrc.

  • Comments out any active alias ... lines, leaving already-commented aliases untouched.

  • Updates history settings:

    • HISTCONTROL=ignoreboth:erasedups

    • HISTSIZE=50000

    • HISTFILESIZE=100000

    • HISTTIMEFORMAT=%F %T

  • Enables persistent history sync after each command via PROMPT_COMMAND='history -a; history -n'.

  • Enables:

    • checkwinsize

    • globstar

  • Removes vi shell editing mode.

  • Removes old managed fastfetch / fzf / starship blocks if they already exist, so reruns do not duplicate them.

  • Appends a clean managed fzf config block.

  • Appends a clean managed fastfetch config block.

  • Appends a clean managed starship init block with fallback PS1.

  • Writes the modified content back to $HOME/.bashrc.

  • It does not touch $HOME/.profile, or your PATH lines.


Nerd font config

Install a nerd font on the WSL

On the Windows PC, download JetBrainsMono Nerd Font, unzip and install JetBrainsMonoNLNerdFont-Regular.ttf from

  • https://www.nerdfonts.com/font-downloads

Open Windows Terminal → Settings → Ubuntu/WSL profile → Appearance and set JetBrains Mono NL as Font face.

Close and reopen Windows Terminal app and open a tab with the "Ubuntu" instance.

Test the Nerd Font:


fzf config

  • Already setup in .bashrc

  • Usage in bash


Starship config

Prerequisites

  • A Nerd Font installed and enabled in your terminal.

Install Sharship

eval "$(starship init bash)" is already added to the end of $HOME/.bashrc during the bash config - if not, add it

Starship configuration file:

  • Basic minimal

  • or Advanced

Reopen the shell or exec bash.

The config does the following:

  • format

    • Defines the full prompt layout.

    • Left side: directory + Git info.

    • Right side: SSH host + background jobs + slow command duration + time.

    • The second line contains only the prompt character.

  • $fill

    • Pushes everything after it to the right side of the terminal.

    • This keeps operational context visible without cluttering the main working area.

  • add_newline = true

    • Adds spacing between command outputs and the next prompt.

    • Improves readability during long terminal sessions.

  • [directory]

    • Shows the current working directory.

    • truncation_length = 3 keeps paths short.

    • truncate_to_repo = false means it does not hide parent directories just because you are inside a Git repo.

    • read_only = " " shows a lock icon when the directory is read-only.

  • [git_branch]

    • Shows the current Git branch only when inside a Git repository.

    • Uses the branch symbol.

    • Kept minimal: branch name only, no language/runtime noise.

  • [git_status]

    • Shows repository state when there are changes.

    • Displays modified, staged, untracked, ahead/behind, etc.

    • Useful for sysadmin config tracking, dotfiles, /etc repos, and deployment directories.

  • [hostname]

    • Shows hostname only over SSH because of ssh_only = true.

    • Prevents local WSL prompts from being noisy.

    • Helps avoid running commands on the wrong remote host.

  • [jobs]

    • Shows when background jobs are running.

    • Useful after commands like long-task &, rsync &, or backgrounded scripts.

    • Hidden when there are no jobs.

  • [cmd_duration]

    • Shows command duration only when a command takes longer than 2 seconds.

    • Good for noticing slow SSH commands, package installs, scans, backups, or scripts.

    • Fast commands stay clean.

  • [time]

    • Shows current time on the right side in 24-hour format.

    • Useful for logs, incident work, and command timing context.

  • [character]

    • Shows the actual prompt symbol.

    • Green means the last command succeeded.

    • Red means the last command failed.

    • is used in Vim command mode.

  • What it intentionally excludes

    • No Python, Node, Go, Rust, Docker, Kubernetes, AWS, package, or runtime modules.

    • That keeps it sysadmin/operator-oriented instead of developer-oriented.

Check Starship documentation for config and presets.

Test and final validation:


Docker


it-tools container

Use it from http://localhost:8080/


WSL Ubuntu Path


Last updated