| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This repository demonstrates how to setup wsl2 (Windows Subsystem of Linux 2) for using Ubuntu-22.04 LTS winthin windows.
wsl --update wsl --list --online wsl --install -d Ubuntu-22.04
lsb_release -a
sudo apt update && sudo apt upgrade -y
sudo apt install gedit
These utilities are useful to make the wsl work much more like a real Ubuntu distribution.
By default the linux terminal doesn't show current git branch in it's prompt. To do this, just add the following line in your .bashrc file
# Show git branch name
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
unset color_prompt force_color_prompt
The output will be something like this
Nautilus is kind of a gui window that allows you to open any specified path/location in a mini file explorer type window. To install it, run the following command
sudo apt install nautilus
To open a specific location with nautilus use the following syntax
nautilus <path-to-folder>.
To open current location with nautilus, use
nautilus .
It will look something like this
By default the wsl terminals doesn't support gnome features.
So in case you use some bash files or python scripts that create multiple gnome tabs, they won't work in default wsl terminals for ubuntu.
In that case, you have to explicitly install gnome-terminal & display it on your screen. To do this, use following commands
sudo apt install gnome-terminal export DISPLAY=:0 gnome-terminal
It will looke somthing like this (the color will be different, as i have configured it according to my interest)
You can just run gnome-terminal command to run the gnome-based terminal.
The location of C:\Users\username in wsl2 is /mnt/c/Users/username. So if you want to acces this location in wsl2 terminal, you can export this value to an environment variable in your .bashrc file.
export win11='/mnt/c/Users/Mohit'
So you can just do the following command to navigate to your windows's user directory from your wsl2 terminal
cd $win11
Open powersheel & type following commands to unregister your installed linux distros
wsl -l wsl --unregister Ubuntu-22.04
Get-AppxPackage MicrosoftCorporationII.WindowsSubsystemForLinux | Remove-AppxPackage
wsl --uninstall
| Back | FazBrowse Home | New Git URL |