wsl_linux_ubuntu_cheatsheet
Table of Contents
WSL / Linux / Ubuntu Cheatsheet
Windows Commands
wsl –install | Install WSL. |
wsl –list | List installed Linux flavours. |
wsl –install -d ubuntu | Install Ubuntu. |
wsl -s ubuntu | Make Ubuntu the default. |
WSL / Linux Commands
sudo apt-get update && sudo apt-get install -y dotnet-sdk-7.0 | Install Dotnet on WSL. |
ll or ls -alF | List files properly. |
sudo apt update && sudo apt upgrade | Update the system. |
sudo -i | Make me root for the rest of the session. |
| File System | |
sudo chmod +x /usr/local/bin/sign-kernel | Make a file executable. |
sudo chmod a+rwx /DirectoryName | Give everyone access. |
ln -s [target_file] [link_name] | Make a symbolic link. |
| Disk Mounting | |
df -hP | List mount points. |
fuser -cu /dev/sda3 | List processes using mount point. |
fuser -k /backup | Kill all process using mount point. |
umount /dev/sda3 or umount /media/stephen | Unmount. |
mount /dev/vdb1 /new_backup | Mount. |
Edit /etc/fstab | Make mount point permanent. |
| Diagnostic Info | |
mokutil –sb-state | SecureBoot status. |
Accessing drives
- In WSL, accessing Windows drive:
/mnt/c/Dev - In Windows, accessing WSL:
\\wsl.localhost\Ubuntu\home
Run commands on Bash start up
Edit your .bashrc file, it will be \\wsl.localhost\Ubuntu\home\<you>\.bashrc, append whatever you want to the bottom.
Mount a Windows Drive
- Get drive info:
sudo fdisk -l, look for something like/dev/sda4. - Make a directory to mount it to:
sudu mkdir /mnt/windows. - Mount it:
sudo mount -t ntfs-3g /dev/sda4 /mnt/windows. Add a-rfor read only.
wsl_linux_ubuntu_cheatsheet.txt · Last modified: 2026/02/15 08:09 by stephen
