# Level up your Linux Shell

## การติดตั้งและปรับแต่ง Zsh Shell ด้วย Powerlevel10k

### สำหรับ Windows (WSL2)

{% embed url="<https://www.youtube.com/watch?v=bw6CC-OTfC8>" %}

### สำหรับ Linux และ MacOS

{% embed url="<https://www.youtube.com/watch?v=eh7lM3Yvf94>" %}

## <mark style="color:red;">Oh</mark> <mark style="color:yellow;">my</mark> <mark style="color:purple;">Zsh</mark> Cheatsheet

### Quick reference:

* Oh My Zsh's Command-Line Interface (CLI): `omz`. Run `omz --help` for available commands.
* To **update** Oh My Zsh: `omz update`.
* To **uninstall** it: `uninstall_oh_my_zsh`.
* To apply changes made to `.zshrc`: `omz reload` (this just runs `exec zsh`). [**Do NOT run `source ~/.zshrc`**](https://github.com/ohmyzsh/ohmyzsh/wiki/FAQ#how-do-i-reload-the-zshrc-file).

ตัวอย่างการตั้งค่า plugins ใน ไฟล์ `.zshrc`

```bash
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.

plugins=(common-aliases history git zsh-autosuggestions zsh-syntax-highlighting kubectl emoji encode64 dirhistory web-search macos sudo web-search c
opyfile copybuffer JsonTools colored-man-pages command-not-found pip python rust brew docker golang history-substring-search iterm2)

```

### Commands

<table><thead><tr><th width="206">Command</th><th>Description</th></tr></thead><tbody><tr><td><code>alias</code></td><td>List all aliases</td></tr><tr><td><code>mkcd</code></td><td>Create a new directory and change to it, will create intermediate directories as required.</td></tr><tr><td><code>take</code></td><td>Like <code>mkcd</code>, but also knows how to handle remote URLs. When given an argument that looks like a URL (something that ends in <code>.git</code> or <code>.tar.(gz|bz2|xz)</code>), download the remote resource and extract it (if necessary) into the current directory. Then change to the newly extracted/downloaded/cloned directory.</td></tr><tr><td><code>zsh_stats</code></td><td>Get a list of the top 20 commands and how many times they have been run.</td></tr></tbody></table>

### Directory

<table><thead><tr><th width="219">Alias</th><th>Command</th></tr></thead><tbody><tr><td><code>md</code></td><td><code>mkdir -p</code></td></tr><tr><td><code>rd</code></td><td><code>rmdir</code></td></tr><tr><td><code>cd</code> / <code>~</code></td><td><code>cd</code> to your home directory</td></tr><tr><td><code>..</code></td><td><code>cd ..</code></td></tr><tr><td><code>...</code></td><td><code>cd ../..</code></td></tr><tr><td><code>....</code></td><td><code>cd ../../..</code></td></tr><tr><td><code>.....</code></td><td><code>cd ../../../..</code></td></tr><tr><td><code>/</code></td><td><code>cd /</code></td></tr><tr><td><code>d</code></td><td><code>dirs -v</code> (lists last visited directories)</td></tr><tr><td><code>cd +n</code></td><td>Switch to directory number <code>n</code></td></tr><tr><td><code>-</code></td><td><code>cd</code> to last visited directory</td></tr><tr><td><code>1</code></td><td><code>cd -1</code></td></tr><tr><td><code>2</code></td><td><code>cd -2</code></td></tr><tr><td><code>3</code></td><td><code>cd -3</code></td></tr><tr><td><code>4</code></td><td><code>cd -4</code></td></tr><tr><td><code>5</code></td><td><code>cd -5</code></td></tr><tr><td><code>6</code></td><td><code>cd -6</code></td></tr><tr><td><code>7</code></td><td><code>cd -7</code></td></tr><tr><td><code>8</code></td><td><code>cd -8</code></td></tr><tr><td><code>9</code></td><td><code>cd -9</code></td></tr></tbody></table>

### Top Popular ZSH Plugins on GitHub <a href="#top-popular-zsh-plugins-on-github-2023" id="top-popular-zsh-plugins-on-github-2023"></a>

{% embed url="<https://safjan.com/top-popular-zsh-plugins-on-github-2023/>" %}

ภายในไดเรกทอรี่ `/etc` จะมีไฟล์ที่ชื่อว่า `lsb-release` ดังคำสั่งข้างล่าง

<div data-full-width="true"><figure><img src="https://1856353139-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MClo3nC-1US0rbK8Qau%2Fuploads%2F4TcQqJJnBKWnrVkNiTIi%2Flsb_release.gif?alt=media&#x26;token=0dbe4e8b-8277-434c-9b0c-3cdc6cd7e981" alt=""><figcaption></figcaption></figure></div>
