Kill processes
Kill zombie processes
Find and kill zombie process(es). Source
Kill parent process(es)
Find and kill zombie process(es). Source
Kill parent process(es)
Set up Windows subsystem for Linux 2 (WSL2) for Linux development experience in Windows 10 and 11.
Open powershell with administrator privilege, run the following command in the host.
or install the components manually
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
After reboot, install the Linux distribution
If you want to move the WSL virtual disk file to another disk (in this example, D:\), run the following commands in Windows12:
wsl --export Ubuntu .\Ubuntu\ext4.tar
wsl --unregister Ubuntu
wsl --import Ubuntu D:\Ubuntu\ .\Ubuntu\ext4.tar
Edit /etc/wsl.conf in the WSL. You may need to set the default user if you have moved the virtual disk file of the WSL distribution.
Edit .wslconfig 3 in your Windows home directory (%USERPROFILE%).
For example,
[wsl2]
memory=20GB # How much memory to assign to the WSL2 VM.
swap=8GB # How much swap space to add to the WSL2 VM. 0 for no swap file.
swapfile=C:\\temp\\wsl-swap.vhdx # Sets swap file path location, default is %USERPROFILE%\AppData\Local\Temp\swap.vhdx. Useful if your C drive has limited disk space.
Edit .wslconfig 3 in your Windows home directory (%USERPROFILE%). 4
[experimental]
autoMemoryReclaim=gradual # Reclaim RAM usage
sparseVhd=true # Reclaim virtual disk (vhd) usage
To (manually) update the WSL kernel, run the following commands with administrator privileges:
Note
Optimize-VHD is not available in Windows Home edition.
To reclaim disk space from virtual hard disks (VHDs), run the following commands with administrator privileges 5:
Alternatively, export the VHD as a tar file and reimport it again.
Cross-OS file access (e.g., accessing /mnt/c in WSL) is at least one order of magnitude (10x) slower than accessing natively (/home/user/).6
https://learn.microsoft.com/zh-tw/windows/wsl/basic-commands#import-and-export-a-distribution ↩↩↩
https://learn.microsoft.com/zh-tw/windows/wsl/wsl-config ↩↩↩↩↩↩
https://devblogs.microsoft.com/commandline/windows-subsystem-for-linux-september-2023-update/ ↩↩↩
https://blog.miniasp.com/post/2023/05/14/Shrink-your-WSL2-Virtual-Disks-and-Docker-Images-and-Reclaim-Disk-Space ↩↩↩
Open Windows Powershell with Administrator rights and run:
See the report at C:\battery-report.html.
Copy the fonts files to ~/.local/share/fonts/. Then, run fc-cache to rebuild fonts cache.
To display frequencies of all CPU cores every second:
When dual-booting Linux and Windows,it might be better to set the clock to the local time zone in Linux1 to in sync with Windows settings.
How to recover Nautilus (File manager in Gnome) places folders.
Arch Wiki: environment variables
/etc/profile is sourced by all POSIX-compatible shells upon login./etc/profile.d/ directory will also be read.~/.profile or ~/.bash_profile for login bash instances.~/.bashrc for every interactive bash instance.~/.zshenv for environment variables in all zsh instances.~/.zprofile for every login zsh instance.~/.zshrc for every interactive zsh instance.Note
zsh does not source ~/.profile by default because of the difference between bash and zsh syntaxes. You can add this line to ~/.zprofile or ~/.zshenv to make zsh shells read `~/.profile correctly.
~/.xinitrc is sourced by startx.~/.xprofile is sourced by display managers (e.g., GDM, SDDM)~/.config/environment.d/*.conf: sourced by systemd. Also, they are used in Wayland sessions where xinitrc and xprofile files are not available.Environment variables in Powershell
Variables created by set are bound to the current session and not persistent.
[Environment]::SetEnvironmentVariable('KEY', 'VAL', 'Machine')SETX KEY VAL