### WSL 安裝與基礎 Linux
---
### What and Why
### Linux & WSL
----
### Linux 是什麼?
----
> 一言以蔽之:作業系統
常見於各種你可能用過或沒有用過的裝置上
----
### 用在哪裡?
<br />
- 伺服器
- 嵌入式系統
- 移動裝置
- 超級電腦(TOP500)
> 也可以是你的電腦!
----
### 為什麼會用?
<br />
- 穩定性
- 安全性
- 自定義性
----
### 有誰在用?
<br />
- Google
- Facebook
- Amazon
- Microsoft
- etc...
----
### 可執行 Linux 的環境
----
1. WSL (Windows Subsystem for Linux)
2. Virtual Machine (VM, 虛擬機)
3. Wubi (將Ubuntu以VHD格式裝成雙系統)
4. 直接安裝 (雙系統或覆蓋安裝)
---
### Why WSL
----
### WSL 優點
- 安裝簡單
- 佔用空間較小
- 可以直接在Windows上運行Linux程式
- 開機速度快
---
### WSL 安裝
----
### 啟用系統功能
----
### 使用系統管理員開啟終端機
如果是 Win10 用戶可在 Microsoft Store 下載

----
跳出此畫面表示成功開啟

----
### 啟用系統功能
將兩行程式複製並貼在終端機執行
> ###### 可能會導致手機模擬器無法使用 但還是得執行👍
```shell=
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
```
確認系統版本(Win10 Only)
```shell=
winver #需要大於18362.1049
```
----
更新WSL核心與修改預設版本
```shell=
wsl --update
wsl --set-default-version 2
```
----
重新開機
> 沒錯就是重開機
----
### 下載 Ubuntu
----
### 到 Microsoft 搜尋 Ubuntu

----
### 點 Ubuntu 22.04 並安裝

----
### 在終端機開啟 Ubuntu
> ###### 如果沒有出現的話就重開終端機
設定使用者名稱與密碼

----
### 安裝 VS Code
----
[點此安裝](https://code.visualstudio.com/)

----
### 開啟 VS Code
安裝 WSL 套件

---
### 安裝 Oh My ZSH
----
### 安裝必要套件
```shell=
sudo apt install wget git curl vim -y
```
----
### 安裝 Patched 字型
[點我下載](https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Regular.ttf)
----
### 到終端機設定字型
----
### 安裝 Zsh
```shell=
sudo apt install zsh -y
```
----
### 安裝 Oh My Zsh
順便把 Shell 換成 Zsh
```shell=
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```
----
跑出這個就代表安裝成功

----
### 設定主題樣式
----
### 安裝插件
PowerLevel10k
```shell=
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
```
zsh-autosuggestions
```shell=
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
```
zsh-syntax-highlighting
```shell=
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
```
----
### 調整設定
```shell=
vi ~/.zshrc
```
點擊 *[i]* 進入編輯模式
----
修改主題
```shell=
ZSH_THEME="powerlevel10k/powerlevel10k"
```
新增套件
```shell=
plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-z)
```
點擊 ESC + [ :wq ] 退出
----
應用修改後的 zshrc
```shell=
source ~/.zshrc
```
----
### 讓黑魔法動起來
```shell=
p10k configure
```
---
### Linux 基礎
----
###
{"title":"WSL安裝與基礎Linux","contributors":"[{\"id\":\"2c84da85-75c3-4d28-b21e-dff3fa4fd4d4\",\"add\":4236,\"del\":1122}]","description":"一言以蔽之:作業系統"}