Windows

Installation
Creating an installation USB
You can download Windows 10 straight from the Microsoft site. Pick a flash drive of at least 8GB for the tool to format and turn into a bootable installer.
If the 715-123130 error appears, try a different browser or download it through a VPN in the USA.
If you download the ISO, check the hash:
PS > Get-FileHash .\Win11_22H2_EnglishInternational_x64v1.iso
Algorithm Hash
--------- ----
SHA256 F115CD6B31734BC091BC94B964D5AD43984285BF229503481E2F7EF94AB7140E
I recommend Rufus for writing the image. It has some quite interesting features.
From a Mac
The Media Creation Tool and Rufus only run on Windows. On a Mac, you can create the installer by
hand with tools that come with macOS, plus wimlib.
The problem is the file system. A UEFI firmware (the code that starts the computer before the
operating system) can always read FAT32. FAT32 cannot store files larger than 4 GB. The
sources/install.wim file in the Windows 11 ISO is 7.6 GB.
Some very new UEFI firmware can also read exFAT, which has no such limit. On those computers, you
can format the drive as exFAT and copy the ISO contents as they are. The computer I was installing
on cannot read exFAT, so I split install.wim into parts smaller than 4 GB. Windows Setup knows
how to read the split files (.swm) without any extra step.
The short version:
- Download the ISO and make sure that its hash is correct.
- Mount the ISO.
- Create a FAT32 partition of at least 8 GB on the USB drive.
- Copy everything from the ISO except
sources/install.wim. - Split
install.wiminto.swmfiles of less than 4 GB. - Eject the drive and the ISO.
In my example I use the German ISO and a 4 TB external drive. The volume name of the mounted ISO
changes with the language, for example CCCOMA_X64FRE_EN-US_DV9 for American English. Replace the
names and the disk identifiers with your own.
1. Make sure that the hash is correct
Compare the result with the SHA256 hash on the Microsoft download page. If sha256sum is not
available on your macOS, use shasum -a 256.
$ sha256sum ~/Downloads/Windows11_Client_x64_de-de_26300_9457.iso
193bbde65ec84e298a1c798959489c8375ed501cf973c6d37fa52bb22ee8d43b /Users/julio/Downloads/Windows11_Client_x64_de-de_26300_9457.iso
2. Mount the ISO
$ hdiutil mount ~/Downloads/Windows11_Client_x64_de-de_26300_9457.iso
/dev/disk5 /Volumes/CCCOMA_X64FRE_DE-DE_DV9
3. Partition the USB drive
Find the identifier of the USB drive:
$ diskutil list external
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *4.0 TB disk4
1: EFI EFI 209.7 MB disk4s1
2: Microsoft Basic Data Julio 4.0 TB disk4s2
whole disk.
My drive is much larger than the installer needs. Thus I create a 32 GB FAT32 partition for Windows
and use the remaining space (R) as an exFAT partition for data. MS-DOS is the name that
diskutil uses for FAT32. GPT is the partition table that UEFI expects.
$ diskutil partitionDisk disk4 GPT MS-DOS WIN11 32G ExFAT DATA R
Started partitioning on disk4
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk4s2 as MS-DOS (FAT) with name WIN11
...
Formatting disk4s3 as ExFAT with name DATA
...
Finished partitioning on disk4
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *4.0 TB disk4
1: EFI EFI 209.7 MB disk4s1
2: Microsoft Basic Data WIN11 32.0 GB disk4s2
3: Microsoft Basic Data DATA 4.0 TB disk4s3
For a normal flash drive, one FAT32 partition is enough:
$ diskutil eraseDisk MS-DOS WIN11 GPT disk4
macOS mounts the new partitions automatically:
$ ls /Volumes
CCCOMA_X64FRE_DE-DE_DV9 DATA 'Macintosh HD' WIN11
4. Copy the files
The install.wim file is too large for FAT32:
$ ls -lh /Volumes/CCCOMA_X64FRE_DE-DE_DV9/sources/ | grep -E "install|boot.wim"
-r-xr-xr-x 1 julio staff 600M Sep 13 21:43 boot.wim
-r-xr-xr-x 1 julio staff 571 Sep 13 21:43 cdplibuninstall.mof
-r-xr-xr-x 1 julio staff 7.6G Sep 13 21:43 install.wim
-r-xr-xr-x 1 julio staff 11K Sep 13 21:43 uninstall_data.xml
-r-xr-xr-x 1 julio staff 4.8K Sep 13 21:43 uninstall.xml
Copy everything else. The trailing / on the source path copies the contents of the volume, not
the volume folder itself.
$ rsync -avh --progress --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_DE-DE_DV9/ /Volumes/WIN11/
sending incremental file list
./
autorun.inf
bootmgr
bootmgr.efi
setup.exe
boot/
...
5. Split install.wim
If you do not have wimlib yet, install it with Homebrew:
$ brew install wimlib
Split the image into parts of 3800 MB. That value stays below the 4 GB limit of FAT32.
$ wimlib-imagex split /Volumes/CCCOMA_X64FRE_DE-DE_DV9/sources/install.wim /Volumes/WIN11/sources/install.swm 3800
Splitting WIM: 7715 MiB of 7715 MiB (100%) written, part 3 of 3
Finished splitting "/Volumes/CCCOMA_X64FRE_DE-DE_DV9/sources/install.wim"
The result is three files in /Volumes/WIN11/sources/:
$ ls -lh /Volumes/WIN11/sources/install*
-rwx------ 1 julio staff 3.8G Nov 19 23:35 /Volumes/WIN11/sources/install.swm
-rwx------ 1 julio staff 3.7G Nov 19 23:36 /Volumes/WIN11/sources/install2.swm
-rwx------ 1 julio staff 130M Nov 19 23:36 /Volumes/WIN11/sources/install3.swm
6. Eject
$ diskutil eject disk4
Disk disk4 ejected
$ hdiutil detach /Volumes/CCCOMA_X64FRE_DE-DE_DV9
"disk5" ejected.
Boot the target computer from the USB drive. In the boot menu, select the UEFI entry for the drive.
From Linux
The steps are the same as on the Mac: a FAT32 partition, the ISO contents, and a split
install.wim. Only the tools are different.
Do not write the ISO with dd. That works for most Linux ISOs. The Windows ISO is not a hybrid
image (an image that boots from a DVD and from a USB drive). A drive written with dd does not
boot.
Install
wimlib. The package iswimtoolson Debian and Ubuntu, andwimlibon Arch and Fedora.$ sudo apt install wimtoolsMake sure that the hash is correct:
$ sha256sum ~/Downloads/Windows11_Client_x64_de-de_26300_9457.isoFind the device name of the USB drive. In these examples it is
/dev/sdX.$ lsblk -o NAME,SIZE,MODEL,TRANMake sure that you use the correct device name. The next commands erase the wholedrive.
Create a GPT partition table with one FAT32 partition, and format it:
$ sudo wipefs -a /dev/sdX $ sudo parted --script /dev/sdX mklabel gpt mkpart WIN11 fat32 1MiB 100% $ sudo mkfs.vfat -F 32 -n WIN11 /dev/sdX1Mount the ISO and the USB drive:
$ sudo mkdir -p /mnt/iso /mnt/usb $ sudo mount -o loop,ro ~/Downloads/Windows11_Client_x64_de-de_26300_9457.iso /mnt/iso $ sudo mount /dev/sdX1 /mnt/usbCopy everything except
install.wim. Use-rinstead of-a, because FAT32 does not store Linux owners and permissions.$ sudo rsync -rh --progress --exclude=sources/install.wim /mnt/iso/ /mnt/usb/Split
install.wiminto parts of 3800 MB:$ sudo wimlib-imagex split /mnt/iso/sources/install.wim /mnt/usb/sources/install.swm 3800Write all data to the drive and unmount both:
$ sync $ sudo umount /mnt/usb /mnt/iso
The umount command can take some minutes, because Linux writes the cached data to the drive
first.
If you do not want to do these steps by hand, Ventoy and WoeUSB-ng do them for you. Ventoy boots ISO files that you copy to the drive, and it uses its own UEFI driver to read exFAT. If Secure Boot is on, you must enroll the Ventoy key on the first boot.
Partitioning
A typical Windows installation creates 4 partitions:
- EFI: 100 MB
- MSR: 16 MB
- Windows
- Recovery: 500 MB to 650 MB
The value you have to type into the graphical installer is the sum of all those partitions. If you
want your C: to show exactly 250 GB, you have to use something slightly larger than 256616 MB
(100 + 16 + 250 * 1024 + 500).
For more control over the sizes, you can partition the disk from the command line. Press
Shift + F10 and use diskpart:
diskpart
list disk
select disk 0
clean
convert gpt
create partition efi size=1024
format quick fs=fat32 label="System"
assign letter="S"
create partition msr size=16
create partition primary size=256000 -> 512000 for 500GB
format quick fs=ntfs label="Windows"
assign letter="W"
create partition primary size=1024
format quick fs=ntfs label="Recovery"
assign letter="R"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
list volume
exit
In this example a 1 GB EFI partition and a 1GB Recovery partition are created.
An EFI of at least 300 MB is recommended for anyone dual booting. Linux mounts that partition as
/boot and stores the files used by the bootloader, including compressed versions of the kernel and
drivers (vmlinuz).
Keeping Windows away from an existing EFI partition
If an EFI partition formatted as FAT32 already exists before the installation, Windows uses it instead of creating a new one. That partition can also be on a different disk.
When you dual boot from one disk, this is usually what you want. When each operating system has its own disk, it is not. Windows then puts its boot files on the other disk. If you remove that disk, Windows does not start.
To stop this, temporarily change the GPT partition type of the existing EFI partition to Basic Data. Windows Setup then does not see it as an EFI partition.
| Partition type | GPT type ID |
|---|---|
| EFI System | c12a7328-f81f-11d2-ba4b-00a0c93ec93b |
| Basic Data | ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 |
In Windows Setup, press
Shift + F10and rundiskpart.Select the disk and the partition that you want to hide. Use
detail partitionto make sure that it is the EFI partition.list disk select disk 1 list partition select partition 1 detail partitionChange the type to Basic Data:
set id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 exitInstall Windows.
After the installation, open
diskpartas administrator, select the same partition again and change the type back to EFI:set id=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
If you forget the last step, the other operating system does not start. Its boot entry points to a partition that is no longer an EFI partition.
Resizing partitions later
If you realize you need to grow the EFI partition after Windows is already installed, have a look at Macrorit’s Partition Expert. The free portable version can resize and move partitions easily.
The 16MB MSR (Microsoft Reserved) partition can be restored by Windows itself
(create partition msr) or with the code 0c01 in cgdisk.
Using a local account
created a local account by default, and you did not need a workaround.
Windows 11 Setup asks you to sign in with a Microsoft account and to connect to the internet. To create a local account (an account that exists only on this computer), do these steps:
On the “Let’s connect you to a network” screen, press
Shift + F10to open a command prompt.Type the following command and press
Enter:start ms-cxh:localonlyIn the window that opens, type a user name and a password for the local account.
In older versions of Windows 11, the command was C:\Windows\System32\oobe\BypassNRO.cmd. Newer
versions do not have this script anymore.
Privacy options
A privacy screen appears on the first boot. Uncheck Find my device, Inking & Typing,
Advertising ID, Diagnostic data, Tailored experiences and anything else you can uncheck during
the installation.
After starting the system, go to Settings » Privacy. I uncheck almost every option. The only app
that needs to reach my camera (which is covered) is Skype.
Group Policy Editor
Run gpedit.msc.
Web search
Go to
Local Computer Policy » Computer Configuration » Administrative Templates » Windows Components » Searchand set the “Do not allow web search” option to Enabled.BitLocker with a PIN
Go to
Computer Configuration»Administrative Templates»Windows Components»BitLocker Drive Encryption»Operating System Drivesand enableRequire Additional Authentication at StartupandAllow enhanced PINs for startup.Turning off Skype’s Meet Now
Go to
User Configuration»Administrative templates»Start Menu and Taskbarand enable theRemove the Meet Now iconpolicy.
Regedit
Turning off Cortana and Bing
Go to
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Searchand create a new DWORD calledConnectedSearchUseWebwith the value 0.Go to
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Searchand create two new DWORDs with the value 0:AllowSearchToUseLocationandBingSearchEnabled.Using UTC for the clock (useful for dual-booting)
Go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformationand create a new DWORD calledRealTimeIsUniversalwith the value 1.Showing/hiding icons on the desktop
This can be done through the graphical interface, so I do not recommend doing it through the regedit.
Computer: {20D04FE0-3AEA-1069-A2D8-08002B30309D} User Files: {59031a47-3f72-44a7-89c5-5595fe6b30ee} Control Panel: {5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0} Network: {F02C1A0D-BE21-4350-88B0-7367FC96EF3C} Recycle Bin: {645FF040-5081-101B-9F08-00AA002F954E}Example:
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /V {20D04FE0-3AEA-1069-A2D8-08002B30309D} /T REG_DWORD /D 0x0 /Freg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu /V {20D04FE0-3AEA-1069-A2D8-08002B30309D} /T REG_DWORD /D 0x0 /Freg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel /V {20D04FE0-3AEA-1069-A2D8-08002B30309D} /T REG_DWORD /D 0x0 /Freg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu /V {20D04FE0-3AEA-1069-A2D8-08002B30309D} /T REG_DWORD /D 0x0 /FNot showing recent files
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer /V ShowRecent /T REG_DWORD /D 0x0 /FShowing the user folder in File Explorer’s navigation pane (quick access)
reg add HKCU\SOFTWARE\Classes\CLSID\{59031a47-3f72-44a7-89c5-5595fe6b30ee} /V System.IsPinnedToNameSpaceTree /T REG_DWORD /D 0x1 /F
Computer name
Go to Control Panel\System and Security\System. On the line with the computer’s name, click Change
settings and change the computer’s name.
Windows Update
Update everything and restart the computer.
The latest update may not be available through Windows Update yet, but it can be installed by hand: https://www.microsoft.com/en-us/software-download/windows10.
Drivers
- Kensington Works
- Nvidia
- The manufacturer’s site
Encryption
BitLocker
After updating Windows, enable BitLocker on the C:/ drive. Save the recovery key somewhere safe (not on the computer itself, of course).
VeraCrypt
It is an open source alternative that can be used to encrypt whole partitions or to create containers. Further on I show how to install it with Chocolatey.
Windows Features
Go to Control Panel\Programs » Turn Windows features on or off.
- Enable “Virtual Machine Platform”
- Enable “Windows Hypervisor Platform” (needed for Docker).
- Enable “Windows Sandbox”
- Enable “Windows Subsystem for Linux”
- Enable “Hyper-V” (for virtual machines)
Power
Go to Control Panel\Hardware and Sound\Power Options\Create a Power Plan and create a power plan
based on High Performance with the following options (under advanced power settings):
- Turn off hard disk after
- On battery: 30 Minutes
- Plugged in: Never
- Sleep
- Sleep after
- On battery: 300 Minutes
- Plugged in: Never
- Sleep after
- Power buttons and lid
- Lid close action
- On battery: Do nothing
- Plugged in: Do nothing
- Power button action
- On battery: Sleep
- Plugged in: Do nothing
- Lid close action
- Display
- Turn off display after
- On battery: 20 Minutes
- Plugged in: 30 Minutes
- Turn off display after
Under Control Panel\Hardware and Sound\Power Options\System Settings, uncheck the
Turn on fast start-up option.
Locking on inactivity
- Screen Saver settings » Blank » 3 min » On resume, display log-on screen
Uninstall unnecessary programs
Under Add or Remove programs, uninstall whatever you will not use.
Turn off annoying messages
Go to
Control Panel\System and Security\Security and Maintenance\Change Security and Maintenance settings.
Uncheck the option to receive messages about Windows Backup.
Package managers
The three best known package managers for Windows are: Chocolatey, Scoop and Winget. This comparison shows the differences between them.
Winget
This is Microsoft’s official package manager. It has been around since the end of 2019. It cannot install fonts or scripts.
winget install `
7zip.7zip `
Bambulab.Bambustudio `
DBBrowserForSQLite.DBBrowserForSQLite `
dbeaver.dbeaver `
Discord.Discord `
Ditto.Ditto `
Elgato.StreamDeck `
Git.Git `
Google.Chrome `
Greenshot.Greenshot `
Insomnia.Insomnia `
Kensington.KensingtonWorks `
MediaArea.MediaInfo.GUI `
Microsoft.PowerShell `
Microsoft.PowerToys `
Microsoft.VisualStudioCode `
Microsoft.WindowsTerminal `
Mozilla.Firefox `
OBSProject.OBSStudio `
PeterDaveHello.TransmissionRemoteGUI `
Plex.Plex `
SlackTechnologies.Slack `
Spotify.Spotify `
tailscale.tailscale `
Telegram.TelegramDesktop `
Valve.Steam `
Vivaldi.Vivaldi `
VB-Audio.Voicemeeter.Banana `
VideoLAN.VLC `
WireGuard.WireGuard `
Zen-Team.Zen-Browser
Winget upgrade
To update every program:
winget upgrade --all --silent --accept-source-agreements --accept-package-agreements --include-unknown --disable-interactivity --force
I run it once in a prompt as admin and once as a normal user.
As admin you only have to authorize one pop-up, but it only updates what is installed at system level. As an ordinary user you can update the programs installed at user level.
Clearing the history
Run this in PowerShell:
# File Explorer Home
Remove-Item -Path "$env:APPDATA\Microsoft\Windows\Recent\*" -Force
Remove-Item -Path "$env:APPDATA\Microsoft\Windows\Recent\AutomaticDestinations\*" -Force
Remove-Item -Path "$env:APPDATA\Microsoft\Windows\Recent\CustomDestinations\*" -Force
# File Explorer address bar
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths" -Force -ErrorAction SilentlyContinue
# Clear typed history in Run dialog
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" -Force -ErrorAction SilentlyContinue
Chocolatey
Update: Chocolatey has more packages than Winget, but that gap has been narrowing. These days I no longer use Chocolatey, so I will not keep this section up to date.
Install it following the most current instructions at https://chocolatey.org/install.
In PowerShell as Admin:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y `
7zip `
calibre `
discord `
ditto `
Firefox `
git `
GoogleChrome `
greenshot `
jellyfin-media-player `
nerd-fonts-Hack `
obs-studio `
slack `
spotify `
steam `
telegram `
transgui `
vlc `
vscode `
wireguard
choco install -y `
ack `
bleachbit `
clonespy `
Cmder `
curl `
darktable `
dbeaver `
digikam `
docker-desktop `
eartrumpet `
Everything `
FreeDownloadManager `
gimp `
gnupg `
google-drive-file-stream `
imagemagick `
irfanview `
jre8 `
mariadb `
microsoft-teams `
miniconda3 `
neovim `
nerd-fonts-CascadiaCode `
nerd-fonts-FiraCode `
nodejs `
notepadplusplus `
okular `
postman `
powershell-core `
powertoys `
restic `
rsync `
sourcetree `
sql-server-management-studio `
thunderbird `
transmission `
treesizefree `
vb-cable `
vcxsrv `
veracrypt `
voicemeeter-banana `
winscp
Updating Chocolatey
List the outdated packages:
choco outdatedUpdate Chocolatey first:
choco upgrade chocolateyUpdate every package:
choco upgrade all -y
PowerShell
Windows 10 and 11 ship with version 5.1 installed, but the newer version is available on GitHub and can be installed with Chocolatey or winget.
With Winget:
winget search Microsoft.PowerShell
winget install --id Microsoft.Powershell --source winget
> $PSVersionTable.PSVersion
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
7 4 1
Execution Policy
PowerShell has the following options for restricting script execution:
Restricted: Does not run scripts. Uses PowerShell in interactive mode only.AllSigned: Only runs scripts signed by a trusted publisher.RemoteSigned: Downloaded scripts have to be signed.Unrestricted: Every script can be run.
I am going to configure it with the RemoteSigned option:
Set-ExecutionPolicy RemoteSigned
Oh My Posh
Oh My Posh is a theme for the Terminal, and it is especially good for PowerShell.
The easiest way to install it is with Winget:
winget install JanDeDobbeleer.OhMyPosh -s winget
Then configure PowerShell to start Oh My Posh:
notepad $PROFILE
And paste the following:
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_lean.omp.json" | Invoke-Expression
Set-PSReadlineOption -EditMode vi -BellStyle None
Those commands will set PowerShell to use the powerlevel10k_lean theme in vi mode. Other themes
can be previewed with the Get-PoshThemes command and on the
official site.
The notepad $PROFILE command edits $profile.currentusercurrenthost. If you want to configure it
for other hosts and users, edit the right file:
$profile.currentusercurrenthost
C:\Users\Julio\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
$profile.currentuserallhosts
C:\Users\Julio\Documents\PowerShell\profile.ps1
$profile.alluserscurrenthost
C:\Program Files\PowerShell\7\Microsoft.PowerShell_profile.ps1
$profile.allusersallhosts
C:\Program Files\PowerShell\7\profile.ps1
Office
I share a Microsoft 365 Family subscription with 5 other people. I think it is well worth it,
because besides Office each of us also gets 1 TB of OneDrive.
On top of that, we often find deals for a prepaid year of Personal, which can be converted into 9
months of Family.
The installer with all the Office 365 programs can be downloaded from your Microsoft account. There you pick the language and the version (32 or 64-bit).
You can also install each program separately from the Microsoft Store, but I do not recommend it.
I like to use Thunderbird as my email client.
- To save space, uncheck the option to sync the folders. That way only the headers will be downloaded;
- Set it to minimize to the taskbar;
- Register your PGP key for signing emails;
- Use a master password to protect the passwords and keys saved in Thunderbird (the
key4.dbfile):Tools » Options » Privacy & Security » use a master password.
To set up email accounts that use two-factor authentication, you can use an app-specific password, or do the initial setup without a password and then change it to OAuth2.
Calendar
For most people, leaving the email tab open in the browser and enabling notifications should be enough, but I use multiple calendars and like to follow them all in the same place and get event alerts on the desktop.
The default Windows application integrates fully with the system and lets you see events straight from the taskbar and get native notifications, but since I already use Thunderbird for email I prefer to configure it to sync my calendars too.
Just displaying the calendar (view only)
The link to your Google calendar can be obtained like this:
- Go to the Google Calendar settings (https://calendar.google.com/calendar/u/0/r/settings);
- Settings for my calendars
- Pick the calendar;
- Integrate calendar;
- Secret address in iCal format
Paste that link into Thunderbird: File » New » Calendar » On the Network » iCalendar (ICS).
The calendar will be marked read-only.
To see the events on the main screen: View » Today Pane » Show Today Pane.
Syncing both ways (view & edit)
The Lightning and Provider for Google add-ons have that feature, but you can also configure Thunderbird to use CalDav like this:
- Google: create an app-specific password at https://myaccount.google.com/apppasswords.
- Zoho:
- Create an app-specific password at Zoho Accounts » Security » App Passwords » Application-Specific Passwords » Generate New Password.
- Enable CalDav under Settings » Calendar » Synchronize » CalDAV.
- Get the Calendar ID under Settings » Calendars » My Calendars.
In Thunderbird, go to File » New » Calendar » On the Network » CalDAV and fill in:
- Username: your@email.com
- Location Google:
https://www.google.com/calendar/dav/your@email.com/events - Location Zoho:
https://calendar.zoho.com/caldav/**Calendar ID**/events
Languages
I like to keep my laptop in English, but it is good to add other languages such as Portuguese.
Settings » Languages » Preferred Languages » Add a preferred language.
Adding/removing languages from PowerShell
PS > $langs = Get-WinUserLanguageList
PS > $langs
LanguageTag : en-GB
Autonym : English (United Kingdom)
EnglishName : English
LocalizedName : English (United Kingdom)
ScriptName : Latin
InputMethodTips : {0809:00020409}
Spellchecking : True
Handwriting : False
PS > $langs.Add('de-DE')
PS > $langs
LanguageTag : en-GB
Autonym : English (United Kingdom)
EnglishName : English
LocalizedName : English (United Kingdom)
ScriptName : Latin
InputMethodTips : {0809:00020409}
Spellchecking : True
Handwriting : False
LanguageTag : de-DE
Autonym : Deutsch (Deutschland)
EnglishName : German
LocalizedName : German (Germany)
ScriptName : Latin
InputMethodTips : {0407:00000407}
Spellchecking : True
Handwriting : False
PS > Set-WinUserLanguageList $langs -Force
PS > $langs.Remove(($langs | Where-Object LanguageTag -like 'de-DE'))
True
PS > $langs
LanguageTag : en-GB
Autonym : English (United Kingdom)
EnglishName : English
LocalizedName : English (United Kingdom)
ScriptName : Latin
InputMethodTips : {0809:00020409}
Spellchecking : True
Handwriting : False
PS > Set-WinUserLanguageList $langs -Force
The phantom keyboard bug
Even in Germany I use English (United Kingdom) as the system and formatting language. For some
unknown reason, Windows insists on adding the German keyboard to the keyboard list.
To make matters worse, it does not appear in the Regedit
(Computer\HKEY_USERS\.DEFAULT\Keyboard Layout\Preload) nor in the language and region options.
You have to add it by hand just so you can remove the German keyboard from the list.
This can also be done from PowerShell:
$langs = Get-WinUserLanguageList
$langs[0].InputMethodTips.Add('0809:00000407')
Set-WinUserLanguageList $langs -Force
$langs[0].InputMethodTips.Remove('0809:00000407')
Set-WinUserLanguageList $langs -Force
Check the code in the Regedit (
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language).
| ID | Tag | Language | Locale |
|---|---|---|---|
| 0x0416 | pt-BR | Portuguese | Brazil |
| 0x0816 | pt-PT | Portuguese | Portugal |
| 0x0409 | en-US | English | United States |
| 0x0809 | en-GB | English | United Kingdom |
| 0x0c0A | es-ES | Spanish | Spain |
| 0x0407 | de-DE | German | Germany |
| 0x1000 | en-150 | English | Europe |
| 0x1000 | en-DE | English | Germany |
The full table: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c
An additional clock
I have been talking a lot with people in Australia and Norway. Since the time zone is quite different, I like to have an additional clock.
Go to Date & Time » Add clocks for different time zones and set up the new clock.
Personalization
Wallpaper
Under
Settings » Personalization, pick a background. I usually leave it as a black Solid color.Colors
Default app mode: Dark
Lock screen
Turn off showing apps on the lock screen and the background on the sign-in screen.
Fonts
Install a Nerd Font.
I recommend Hack NF. Unzip the package, select all the “Windows Compatible” fonts, right click and pick Install or Install for all users.Alternatively, install it with
oh-my-posh. In a PowerShell as admin:oh-my-posh font install hackAnother good one is JetBrains Mono.
Install the Google Noto Fonts to avoid problems with unavailable characters (shown as rectangles). Prefer the hinted version.
Showing/hiding icons on the desktop
Themes » Desktop Icon Settings. I like to keep My Computer, Recycle Bin and the User folder.Taskbar
Remove all the junk from the taskbar. Hide the search bar.
Turn off programs that start with the system
Open the task manager and turn off the programs that start with the system.
File Explorer
Open File Explorer. Select
View » Options » Change folder and search options. On the View tab, check/uncheck the options:- Always show menus
- Display the full path in the title bar
- Show hidden files, folders, and drives
- Hide extensions for known file types
- Hide protected operating system files
Removing OneDrive from quick access
[HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}] "System.IsPinnedToNameSpaceTree"=dword:00000000[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}] "System.IsPinnedToNameSpaceTree"=dword:00000000Default Apps
- Music player: VLC
- Photo viewer: IrfanView
- Video player: VLC
- Web browser: Firefox
I also like to associate programs with extensions:
.txt→ Notepad++
Chrome and Firefox
Sync the browsers. Copy the settings of extensions such as uMatrix, if you have any.
Swapping Esc with CapsLock
This can be done through the Regedit, SharpKeys, PowerToys and many others.
Regedit
Save the following code as
caps_swapescape.regand run it:Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] "Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,01,00,01,00,3a,00,00,00,00,00A mapping consists of a 32-bit integer (two 16-bit scancodes) in little-endian format.
(03,00,00,00)→ Says that 3 integers follow (96 bits = 24 hex digits)(01,00)→ Escape(3a,00)→ CapsLockSharpKeys
Caps Lock (00_3A) → Escape (00_01) Escape (00_01) → Caps Lock (00_3A)
PowerToys Enable Keyboard Manager » remap a key
Desktops
Swipe up with four fingers on the touchpad to get the option to create new desktops. I like to use 2 desktops.
Terminal
I like Cmder and Windows Terminal (available in the Microsoft Store). They are quite customizable. One important change is setting the font. I recommend Hack NF.
In the Terminal (settings.json):
…
"actions": [
{
"command": {
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{
"command": "paste",
"keys": "ctrl+shift+v"
},
{
"command": "find",
"keys": "ctrl+shift+f"
},
{
"command": {
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"keys": "alt+shift+d"
},
{
"command": {
"action": "sendInput",
"input": "\u001b[13;2u"
},
"keys": "shift+enter"
},
{
"command": {
"action": "sendInput",
"input": "\u001b[13;5u"
},
"keys": "ctrl+enter"
},
{
"command": {
"action": "sendInput",
"input": "\u001b[13;6u"
},
"keys": "ctrl+shift+enter"
},
{
"command": {
"action": "sendInput",
"input": "\u001b[32;2u"
},
"keys": "shift+space"
},
{
"command": {
"action": "sendInput",
"input": "\u001b[32;5u"
},
"keys": "ctrl+space"
},
{
"command": {
"action": "sendInput",
"input": "\u001b[32;6u"
},
"keys": "ctrl+shift+space"
}
]
…
"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
…
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu",
"fontFace": "Hack NF",
"source": "Windows.Terminal.Wsl"
},
…
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"name": "PowerShell",
"fontFace": "Hack NF",
"source": "Windows.Terminal.PowershellCore"
}
I change the paste command from ctrl+v to ctrl+shift+v so it does not break visual mode in
vim.
Sandbox
For testing applications, especially ones of dubious origin, it is advisable to use an isolated system: sandboxes or virtual machines.
For cases where persisting installations and settings is neither necessary nor desirable, and the current version of Windows works, a sandbox is handier than a VM. There are no images to download, it opens faster, it takes up less disk space, and so on.
Sandboxing can be done with programs such as Sandboxie, but Windows 10 Professional already has this feature built in; it just has to be enabled.
The configuration is quite simple and performance is good. Windows Sandbox uses Windows Containers technology which, in turn, uses Hyper-V.
The Sandbox can be enabled under Windows Features or with the following command in PowerShell:
Enable-WindowsOptionalFeature -Online -FeatureName "Containers-DisposableClientVM"
The configuration is done through XML files with the .wsb extension, like this one:
<Configuration>
<VGpu>Disable</VGpu>
<Networking>Disable</Networking>
<MappedFolders>
<MappedFolder>
<HostFolder>C:\Share</HostFolder>
<SandboxFolder>C:\Share</SandboxFolder>
<ReadOnly>true</ReadOnly>
</MappedFolder>
</MappedFolders>
<AudioInput>Disable</AudioInput>
<VideoInput>Disable</VideoInput>
<ProtectedClient>Enable</ProtectedClient>
<PrinterRedirection>Disable</PrinterRedirection>
<ClipboardRedirection>Disable</ClipboardRedirection>
<MemoryInMB>8192</MemoryInMB>
<LogonCommand>
<Command>explorer.exe C:\Share</Command>
</LogonCommand>
</Configuration>
That example starts a sandbox in protected mode, with 8 GB of RAM, read access to the C:\Share
folder and no access to the network, microphone, webcam, printer or clipboard.
Virtualization: Hyper-V
Microsoft Sandbox is great for quick tests and for running portable applications, but it does not cover the use case where changes to the system have to persist. For those cases we should use virtual machines.
If you have a powerful server, it may be worth installing a virtual machine manager such as Proxmox VE and using the VMs over remote access. Depending on the case, spinning up a VM in the cloud is a good idea too.
For local installations on Windows there are also several hypervisor options, which can be of two types:
- Type 1 hypervisor:
- Bare-metal, native
- Reaches the hardware directly
- Better performance
- Examples: VMware ESXi (VMware vSphere), Microsoft Hyper-V, Oracle VM, Citrix Hypervisor
- Type 2 hypervisor:
- Hosted
- Runs on top of the operating system
- Easier to manage
- Examples: VMware Fusion, VMware Workstation Pro, Oracle VM VirtualBox
They say VMware has the most features, but I have been using the Hyper-V that comes with Windows Pro, mainly because of the cost.
You can install Linux, FreeBSD and Windows in Hyper-V. One detail is that virtualized Windows needs a license too.
Tips:
- Prefer to use Generation 2.
- Enable TPM: Security » Enable Trusted Platform Module
- Create checkpoints (snapshots) before any change
- Offline installation (Windows 11): use
start ms-cxh:localonly, as in Using a local account. In older versions:- Press
Shift + F10to open the terminal - Run
C:\Windows\System32\oobe\BypassNRO.cmd - Click “I don’t have internet”
- Click “Continue with limited setup”
- Press
- In enhanced session mode you can copy and paste files between host and VM
- You can mount “.vhdx” virtual disks to share files. Remember to unmount them before starting the VMs.
- Enable Guest services
An Nvidia graphics card in Hyper-V
Because of a security flaw, Microsoft disabled the “RemoteFX vGPU” option that let several VMs share a GPU.
On Windows Server there is the option of allocating a GPU entirely to a VM, so-called GPU passthrough via Discrete Device Assignment (DDA). But only Enterprise GPUs such as the Nvidia Quadro work.
The only current solution is GPU Paravirtualization/GPU Partitioning. See the following links
for more information:
- Easy-GPU-PV: https://github.com/jamesstringerparsec/Easy-GPU-PV
- https://www.youtube.com/watch?v=XLLcc29EZ_8
Get-VMHostPartitionableGpu
WSL2
After enabling “Windows Subsystem for Linux” in the Windows Features, you still have to set the environment up.
Tip: much of what I wrote in the article about Arch applies to Ubuntu on WSL too.
Tip 2: If you want to apply a setting to every distro, use the file
C:\Users\<UserName>\.wslconfig instead of /etc/wsl.conf.
Install the kernel update
Update WSL, if needed
wsl --updateSet WSL2 as the default:
wsl --set-default-version 2List the available distros
wsl --list --onlineInstall a distro (Ubuntu 22.04 or 24.04)
Option 1:
wsl --install -d Ubuntu-24.04Option 2: through the Microsoft Store
Option 3: from the command line
cd ~\Downloads curl.exe -L -o ubuntu-2204.appx https://aka.ms/wslubuntu2204 Add-AppxPackage .\ubuntu-2204.appxRun the file
~\Downloads\ubuntu-2204.appx. A message will appear saying Ubuntu is already installed, along with a button markedlaunchto start Ubuntu.
Check that the WSL version is 2:
wsl --list --verboseIf your version is 1, run
wsl --set-version Ubuntu 2.Set the default distro (if you install more than one)
wslconfig /setdefault Ubuntu-24.04[Optional] Move the image from
C:toZ:WSL2’s VHDs (virtual hard disks) are saved in
C:\Users\[user]\AppData\Local\Packages\[distro]\LocalState\[distroPackageName].
For example:C:\Users\Julio\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx.You can move the image and change the path through the Regedit, but there is a safer way using the export and import functions:
Z: mkdir Z:\WSL wsl --export Ubuntu Z:\WSL\Ubuntu.tar wsl --unregister Ubuntu wsl --import Ubuntu Z:\WSL\ Z:\WSL\Ubuntu.tar ubuntu.exe config --default-user julio rm Z:\WSL\Ubuntu.tarUpdate (2024): there is now the
wsl --import-in-placeoption:wsl --import-in-place Ubuntu-24.04 Z:\WSL\Ubuntu-24.04\ext4.vhdxCheck the Ubuntu version
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.1 LTS Release: 24.04 Codename: nobleAdjust the locales
sudo nvim /etc/locale.gen sudo locale-genDo not add Windows folders to the
$PATHAdd the following lines to the
/etc/wsl.conffile:[interop] appendWindowsPath = falseThat improves command line autocomplete performance significantly, since reaching the Windows file system is very slow.
You can still start programs from WSL; just use the full path or add symlinks in some folder that is already on the $PATH.
See https://learn.microsoft.com/en-us/windows/wsl/wsl-config#interop-settings
Enable Systemd
A feature available since WSL version 0.67.6. It is now the default.Some programs (Snap, Flatpak, microk8s) depend on Systemd.
Add the following lines to the
/etc/wsl.conffile:[boot] systemd=trueRestart WSL:
wsl.exe --shutdown.Configure the memory
WSL2 runs on Hyper-V. By default, half (or 80% in newer builds) of the machine’s memory is allocated. That value can be changed through the
C:\Users\julio\.wslconfigfile:wsl --shutdown notepad "$env:USERPROFILE/.wslconfig"[wsl2] memory=16GB swap=0 processors=4Check it with the
freecommand in Linux.Notes:
- Do not set too high a value, since whatever is allocated to Linux cannot be used by Windows.
- To free memory, run
echo 1 >> /proc/sys/vm/drop_cachesas root. - The
.wslconfigfile has to be saved as UTF-8 without BOM. - The swap is saved in
%USERPROFILE%\AppData\Local\Temp\swap.vhdx
Add additional repositories (PPAs):
PPAs (Personal Package Archive) are repositories in addition to Ubuntu’s own. Many of them come from the official maintainers.
- Neovim:
sudo add-apt-repository ppa:neovim-ppa/unstable sudo apt update- Git
sudo add-apt-repository ppa:git-core/ppa sudo apt updateUpdate the system
sudo apt update && sudo apt upgradeInstall programs available through the repositories:
The basics:
sudo apt install \ ack \ curl \ ffmpeg \ git \ gitk\ jq \ make \ neovim \ p7zip-full \ renameutils \ rsync \ sshfs \ tree \ unzip \ wget \ xclip \ zsh \LaTeX:
sudo apt install \ latexmk \ texlive-lang-portuguese \ texlive-xetexUtilities:
sudo apt install \ ripgrep \ fd-find \ oathtoolClone the dotfiles (https://github.com/jbsilva/dotfiles) and create the links to the configuration files
cd ~ ln -s dotfiles/.zsh ln -s dotfiles/.zshrc ln -s dotfiles/.gitconfig-wsl .gitconfig ln -s dotfiles/.p10k.zsh ln -s dotfiles/.configInstall programs from other sources:
The Ubuntu repository does not always have the newest versions of the packages.
Alternatives:- PPAs
- Snap
- Flatpak
- Appimage
.debpackages- Pre-compiled executables
- Asdf
- Cargo
- pipx
- uvx
- Compiling the source code
Asdf
Update (2025):
asdf was rewritten in Golang in version v0.16.0. You can now download a single binary:
curl -sL https://api.github.com/repos/asdf-vm/asdf/releases/latest | \ jq -r '.assets[] | select(.name | test("^asdf-v.*-linux-amd64.tar.gz$")).browser_download_url' | \ xargs curl -sL | \ tar xz -C ~/bin/The
asdf globalandasdf localcommands were replaced byasdf set.Configure it following the documentation, my .zshrc or the plugin.
The old way:
git clone https://github.com/asdf-vm/asdf.git ~/.asdfuv
curl -LsSf https://astral.sh/uv/install.sh | shPython
(Updated in 2025)
There are several ways to install Python:
Ubuntu’s official repository
sudo apt install python3That is the easiest way, but you cannot say which version you want or keep multiple versions at the same time.
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.11That is a good alternative. It lets you install multiple versions without having to compile.
curl https://pyenv.run | bash pyenv versions pyenv install "3.13"Pyenv compiles the versions you pick. Install the dependencies:
sudo apt install \ build-essential \ libbz2-dev \ libffi-dev \ liblzma-dev \ libncursesw5-dev \ libreadline-dev \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ libxmlsec1-dev \ llvm \ tk-dev \ xz-utils \ zlib1g-devasdf install python latest:3.10 # asdf local python latest:3.10 asdf set python latest:3.10asdf-python is a plugin for asdf that uses Pyenv to build and install. It makes sense if you are also going to use asdf for other languages such as nodejs or ruby.
uv python install 3.12uvlets you download a pre-compiled version of Python from python-build-standalone.Be aware that some programs are incompatible with those builds, because they do not link against system libraries.
Unfortunately
uvdoes not yet have a--buildto cover those cases, but for everything else it is what I use. The builds are well optimized and I do not have to waste time compiling.[pixi]
pixi global install python=3.12
Mambaforge
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh bash Mambaforge-Linux-x86_64.shFlatpak (enable Systemd first):
sudo apt install flatpak gnome-software-plugin-flatpak gnome-softwareflatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepoflatpak updateCompilers and build tools
Make sure you have some compilers and linkers installed:
sudo apt install \ build-essential \ cmake \ ninja-build \ clang \ -yRust
Install it with:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shGo
The easiest way is with asdf.
asdf ...But if you only want the latest version:
sudo rm -rf /usr/local/go && \ wget -qO- "https://go.dev/dl/$(curl -s 'https://go.dev/dl/?mode=json' | \ jq -r '.[0].files[] | select(.os=="linux" and .arch=="amd64") | .filename')" | \ sudo tar -C /usr/local -xzf - && \ go versionFor the local user only:
mkdir -p $HOME/.local && \ wget -qO- "https://go.dev/dl/$(curl -s 'https://go.dev/dl/?mode=json' | \ jq -r '.[0].files[] | select(.os=="linux" and .arch=="amd64") | .filename')" | \ tar -C $HOME/.local -xzf - && \ export PATH=$PATH:$HOME/.local/go/bin && \ go versionHugo
curl -sL https://api.github.com/repos/gohugoio/hugo/releases/latest | \ jq -r '.assets[] | select(.name | test("^hugo_extended_withdeploy_.*_linux-amd64\\.deb$")).browser_download_url' | \ xargs wget -q --show-progress -O hugo.deb && \ sudo dpkg -i --force-overwrite hugo.deb && \ sudo apt-get install -f && \ rm -f hugo.deb && \ hugo versionor
CGO_ENABLED=1 go install --tags extended github.com/gohugoio/hugo@latestor
HUGO_LATEST="0.121.1" wget -qO- https://github.com/gohugoio/hugo/releases/download/v${HUGO_LATEST}/hugo_extended_${HUGO_LATEST}_linux-amd64.tar.gz | tar xvz hugo -C ~/bin/or
asdf plugin add hugo HUGO_LATEST=$(asdf list-all hugo | tail -1) asdf install hugo extended_$HUGO_LATEST asdf global hugo extended_$HUGO_LATESTZellij:
curl -sL https://api.github.com/repos/zellij-org/zellij/releases/latest | \ jq -r '.assets[] | select(.name | test("^zellij-x86_64-.*-linux-.*.tar.gz$")).browser_download_url' | \ xargs curl -sL | \ tar -xz -C ~/bin/ "zellij"Yt-dlp:
uv tool install yt-dlpor
python -m pip install -U --pre yt-dlpor
mkdir -p ~/bin wget -O ~/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux yt-dlp --update-to nightlyExifTool:
ExifTool is a very useful program for keeping my photo library organized.
mkdir -p ~/bin EXIFTOOL_LATEST=12.70 wget -qO- https://exiftool.org/Image-ExifTool-${EXIFTOOL_LATEST}.tar.gz | tar xvzf - -C ~/bin/ mv ~/bin/Image-ExifTool* ~/bin/ExifTool ln -s ~/bin/ExifTool/exiftool ~/bin/exiftoolAWS CLI
sudo snap install aws-cli --classic aws --versionor
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/installor with
asdf:asdf plugin add awscli asdf install awscli latest asdf global awscli latestgit-filter-repo
uv tool install git-filter-repoTailwind
curl -sL "https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64" -o ~/bin/tailwindcss chmod +x ~/bin/tailwindcssWatchman
See https://facebook.github.io/watchman/docs/install
curl -sL https://api.github.com/repos/facebook/watchman/releases/latest | \ jq -r '.assets[] | select(.name | test("^watchman-.*-linux\\.zip$")).browser_download_url'Set the default shell:
chsh -s $(which zsh)
GNOME Keyring
There are several programs for storing passwords, keys and certificates safely. GNOME Keyring is one of the most popular and is compatible with other programs such as Docker, Git, Chromium and GnuPG.
It was made to be used with a graphical interface, but I managed to use it on headless Ubuntu.
Install it with apt
sudo apt install gnome-keyringThe
gnome-keyring-daemonwill be started automatically by systemd after login, but it will be locked.Unlock gnome-keyring when starting a terminal (I use ZSH)
echo 'eval $(echo -n db | gnome-keyring-daemon --unlock --replace 2> /dev/null)' >> ~/.zshrcTest it
uvx keyring set system username uvx keyring get system username
Alternatives: pass, Hashicorp Vault, kwallet
Sharing files between distros in WSL2
Run the following command to create a file telling systemd to mount the current distribution’s /
folder at /mnt/wsl/instances/$DISTRO. The /mnt/wsl/ folder (or whatever is set in
[automount].root) is shared by every running distribution.
cat <<EOF | sudo tee /etc/systemd/system/mnt-wsl-instances-${WSL_DISTRO_NAME/-/}.mount
[Unit]
Description=WSL Instances
[Mount]
What=/
Where=/mnt/wsl/instances/${WSL_DISTRO_NAME/-/}
Type=none
Options=defaults,bind,X-mount.mkdir
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable mnt-wsl-instances-${WSL_DISTRO_NAME/-/}.mount --now
Compacting the WSL2 image
Compacting the image can save a few MBs.
In WSL2:
# apt autoremove && apt autoclean && apt clean # fstrim /In PowerShell:
> Get-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName PackageFamilyName ----------------- CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc> wsl --shutdown > optimize-vhd -Path "C:\Users\Julio\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx" -Mode full
X server
Install VcXsrv and allow it through the firewall (Windows
Defender).
Check the Disable access control option.
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
Note: the best way to get the clipboard working in Neovim is with win32yank.exe. It is installed along with Neovim for Windows, but it can be installed by hand:
mkdir ~/bin
export PATH=$HOME/bin:$PATH
wget https://github.com/equalsraf/win32yank/releases/latest/download/win32yank-x64.zip
unzip -p win32yank-x64.zip win32yank.exe > ~/bin/win32yank.exe
chmod +x ~/bin/win32yank.exe
rm -f win32yank-x64.zip
Copy to the + register with "+y. Alternatively, use :set clipboard=unnamedplus in Neovim.
Docker Desktop with WSL2
This option is the simplest, but it is only free for personal, academic, open-source or small business use (fewer than 250 employees AND less than 10 million USD in annual revenue).
Download Docker Desktop (through Chocolatey, for example).
Check the Use the WSL 2 based engine and Expose daemon on tcp://localhost:2375 without TLS
options.
That is already enough to use Docker normally in the Ubuntu terminal.
Docker with WSL2 without Docker Desktop
Docker Desktop is paid for use in large companies, but it is not needed to run Docker.
There are several alternatives:
- Installing docker directly in the distro on WSL2 (with Systemd or containerd)
- Podman
- Rancher Desktop
Docker on WSL2 with Systemd
Elsewhere in this article I explain how to enable Systemd by editing the /etc/wsl.conf file.
The simplest way to install Docker is with the following script:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh ./get-docker.sh --dry-run
It will print the commands to be run. Remove the --dry-run to actually run them.
If you want to do it step by step without a script:
Remove old packages
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; donesudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extrassudo rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd rm ~/.docker/config.jsonAdd Docker’s official
aptrepository# Adds Docker's official GPG key sudo apt update sudo apt install ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg# Adds the apt repository to the list echo \ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullInstall Docker and the docker-compose-plugin
sudo apt update && \ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginUpdate: docker-compose v1 is the old Python version, with no updates since May 2021. The plugin was rewritten in Go and its command is now
docker compose(with a space instead of a hyphen).Optionally, add your user to the
dockergroup so you do not needsudo:sudo usermod -aG docker $USERCheck for possible updates in the official documentation.
Be aware that this can be a security hole. If you want a safer (though more limited) option, look up how to run the daemon in rootless mode.
Test the installation
sudo docker run hello-worldConfigure where to store the credentials (Credential Helper)
This is useful if you run
docker loginto manage images on Docker Hub or in a private repository. Without a credential helper, the password is stored in plaintext (base64) in the~/.docker/config.jsonfile.Alternative 1: Pass
sudo apt install gnupg2 pass sudo apt install golang-docker-credential-helperswget -q -O ~/bin/docker-credential-pass $(wget -q -O - https://api.github.com/repos/docker/docker-credential-helpers/releases | \ jq -r '.[0].assets[] | select(.name | test("^docker-credential-pass-.*linux-amd64$")) | .browser_download_url') && chmod +x ~/bin/docker-credential-passIn
~/.docker/config.json:{ "credsStore": "pass" }Alternative 2: gnome-keyring
Install and configure it as explained in Gnome Keyring.
wget -q -O ~/bin/docker-credential-secretservice $(wget -q -O - https://api.github.com/repos/docker/docker-credential-helpers/releases | \ jq -r '.[0].assets[] | select(.name | test("^docker-credential-secretservice-.*linux-amd64$")) | .browser_download_url') && chmod +x ~/bin/docker-credential-secretserviceIn
~/.docker/config.json:{ "credsStore": "secretservice" }
Docker with Rancher Desktop
Rancher is a good replacement for Docker Desktop and is especially good for Kubernetes. It can be installed with Chocolatey:
choco install rancher-desktop
NVIDIA Container Toolkit
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt update && sudo apt install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
$ cat /etc/docker/daemon.json
{
"runtimes": {
"nvidia": {
"args": [],
"path": "nvidia-container-runtime"
}
}
}
sudo systemctl restart docker
Test it with the following command:
docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
Visual Studio Code with WSL2
VS Code installed on Windows integrates natively with WSL2. You will have to install the extensions in WSL2 too.
A GUI for Git
Git on the command line is excellent for almost everything, but some tasks are easier to do visually.
Tools installed on Windows can suffer performance problems when reaching the WSL file system, so I recommend installing them directly in Linux. That rules out some GUIs such as Sourcetree.
The tools I have tried and liked are:
- It already comes with a good version control tool. Some extensions have more features, but I do not use them.
- It was the first GUI for Git. I use it a lot for viewing changes in a single file.
- It is very complete and pretty, but paid.
sudo apt update sudo apt install -y libgbm-dev libnotify4 wget https://release.gitkraken.com/linux/gitkraken-amd64.deb sudo dpkg -i ./gitkraken-amd64.deb sudo apt install -fThrough Flatpak:
$ flatpak search gittyup Name Description Application ID Version Branch Remotes Gittyup Graphical Git client com.github.Murmele.Gittyup v1.3.0 stable flathubflatpak install flathub com.github.Murmele.Gittyupflatpak run --nosocket=fallback-x11 --socket=x11 com.github.Murmele.GittyupAppImage:
wget -q -O ~/bin/gittyup \ $(wget -q -O - https://api.github.com/repos/Murmele/Gittyup/releases | \ jq -r '.[0].assets[] | select(.name | test("^Gittyup.*AppImage$")) | .browser_download_url') && \ chmod +x ~/bin/gittyup && \ gittyup --version
Reaching it over SSH
WSL2 is a virtual machine with its own IP address.
That address can be found in the following ways:
Install OpenSSH
sudo apt install openssh-serverAdjust the settings in
/etc/ssh/sshd_configPort 2255 ListenAddress 0.0.0.0 PasswordAuthentication yesFind the VM’s IP address
Using iproute2 in WSL2:
$ ip addr show eth0 … inet 172.21.145.176/20 brd 172.21.159.255 scope global eth0 …Or, from PowerShell:
❯ $wsl_ip = wsl -- ip -o -4 -j addr s eth0 | ConvertFrom-Json | %{ $_.addr_info.local } | ?{ $_ } ❯ $host_ip = (Get-NetIPAddress).IPAddress | ?{ $_ -match ($wsl_ip -replace '^((\d+\.){2}).*$','^$1') } ❯ $wsl_ip,$host_ip 172.30.121.114 172.30.112.1Check that the service is running
Read the passage above on enabling Systemd first.
$ sudo systemctl status sshd.service ● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled) Active: active (running) since…Create a portproxy between the VM and the Host
In a PowerShell as admin:
netsh interface portproxy add v4tov4 listenport=2255 listenaddress=0.0.0.0 connectport=2255 connectaddress=$wsl_ipOpen port 2255 in the Firewall
netsh advfirewall firewall add rule name="Open Port 2255 for WSL2" dir=in action=allow protocol=TCP localport=2255$ netsh interface portproxy show v4tov4 Listen on ipv4: Connect to ipv4: Address Port Address Port --------------- ---------- --------------- ---------- 0.0.0.0 2255 172.30.121.114 2255To undo it
Remove the port forwarding rule:
netsh interface portproxy delete v4tov4 listenport=2255 listenaddress=0.0.0.0Check the change:
netsh interface portproxy show v4tov4Remove all the settings:
netsh interface portproxy resetRemove the firewall rule:
netsh advfirewall firewall delete rule name="Open Port 2255 for WSL2" protocol=TCP localport=2255Check:
$ netsh advfirewall firewall show rule name="Open Port 2255 for WSL2" No rules match the specified criteria.netsh advfirewall firewall show rule name=all | Select-String -Pattern "WSL" -Context 0,4
Scanner
There are many programs for talking to a scanner, but the best I know of is XSane, which is a frontend for SANE.
sudo apt install xsane
I have a Canon Pixma MG5450 all-in-one. Its full name does not appear on the supported devices page, but it is part of the “PIXMA MG5400 Series”, which is covered by the sane-pixma backend.
The scanimage -L command broadcasts to detect connected scanners. By default, Canon devices can be
discovered with the BJNP protocol on UDP port 8612.
Unfortunately that command did not detect my scanner at first.
I knew it was not a connection error, since curl http://192.168.15.7 returns the all-in-one’s page
(that IP is fixed on my DHCP server).
The solution was to spell out the all-in-one’s IP in the pixma.conf file:
echo "bjnp://192.168.15.7" | sudo tee -a /etc/sane.d/pixma.conf
The command worked without trouble after that:
$ scanimage -L
device `pixma:MG5400_192.168.15.7' is a CANON Canon PIXMA MG5400 Series multi-function peripheral
The --all parameter lists the possible options compatible with the backend in use:
$ scanimage --device "pixma:MG5400_192.168.15.7" --all
Output format is not set, using pnm as a default.
All options specific to device `pixma:MG5400_192.168.15.7':
Scan mode:
--resolution auto||75|150|300|600|1200|2400dpi [75]
Sets the resolution of the scanned image.
--mode auto|Color|Gray|Lineart [Color]
Selects the scan mode (e.g., lineart, monochrome, or color).
--source Flatbed [Flatbed]
Selects the scan source (such as a document-feeder). Set source before
mode and resolution. Resets mode and resolution to auto values.
…
That way I could scan a document at 150 dpi straight from the command line using scanimage:
scanimage \
--device "pixma:MG5400_192.168.15.7" \
--format=png \
--output-file scan.png \
--resolution 150 \
--progress
But with XSane it is much easier.
Audio
Programs such as Virtual Audio Cable and Voicemeeter are useful for setups with multiple speakers and for streaming. The free versions of both can be installed with Chocolatey.
- Go to
Control Panel\Hardware and Sound » Sound; - Under Playback, set VoiceMeeter Input as the default device and VoiceMeeter Aux Input as the default communication device;
- Under
Recording, set VoiceMeeter Output as the default device and VoiceMeeter Aux Output as the default communication device; - Go to the
Advancedtab in each device’s properties and set the sample rate (e.g. 24 bit, 48000 Hz). The sample rate has to be set to the same value in Voicemeeter (under Menu » System settings » Preferred Main SampleRate). - An example Voicemeeter Banana configuration:
- Hardware Input 1: The laptop’s microphone
- Hardware Input 2: The headset’s microphone
- Hardware Input 3: CABLE Output (VB-Audio Virtual Cable)
- Voicemeeter VAIO: Desktop output » A1, B1
- Voicemeeter AUX: Calls output » A1
- A1: WDM: Speakers / Headphones
- A2: WDM: Headset
- A3: WDM: TV connected over HDMI
Note 1: I only configure my Bluetooth headset’s microphone when I am going to use it, since that saves power and lets me use the headphones in the higher sound quality mode.
Note 2: I had a problem with Spotify after installing Voicemeeter. I fixed it by reinstalling Spotify.
Another very useful program is EarTrumpet. It lets you set, for each program, which audio output to use and at what volume.
Streaming
For video calls where I want to share the sound playing on the computer as well as my microphone, but without the sound of the call itself (the other participants’ voices):
- In Meets/Teams/Discord/Skype:
- Microphone: VoiceMeeter Output
- Speaker: VoiceMeeter Aux Input
- In VoiceMeeter:
- Mic PC: B1
- Desktop (Voicemeeter VAIO): A1, B1
- Calls (Voicemeeter AUX): A1
Links
- https://github.com/bitsadmin/winconfig/tree/master/CleanWindows
- https://www.dedoimedo.com/computers/windows-10-essential-post-install-tweaks.html
- https://nickymeuleman.netlify.app/blog/linux-on-windows-wsl2-zsh-docker
- https://github.com/neovim/neovim/wiki/FAQ#how-to-use-the-windows-clipboard-from-wsl
- https://vb-audio.com/Voicemeeter/VoicemeeterBanana_UserManual.pdf
- https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-configure-using-wsb-file
- https://aka.ms/wslsystemd
- https://learn.microsoft.com/en-us/windows/wsl/wsl-config
- https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html

I’m a Brazilian-German computer engineer based in Germany, passionate about tech, science, photography, and languages.
I’ve been programming for about two decades already, exploring everything from mobile apps and web development to machine learning. These days I focus on cloud SRE and data engineering.
I volunteer in the open source and Python communities, helping organize PyCon DE and PyData Berlin, serving on the PSF D&I Work Group, mentoring, and contributing code and translations.
On my blog, I share Linux tips, setup guides, and personal notes I’ve written for future reference. I hope others find them helpful as well. The content is available in multiple languages.
Browse my gallery for some of my photography.
Away from the keyboard, you’ll find me at concerts, playing clarinet, cycling, scuba diving, or exploring new places, cultures, and cuisines.
Always happy to connect! 🙂