# Linux CLI

### 為何要學CLI

許多介紹 Linux 的方法，一半以上的篇幅在講解"圖形操作界面"( **G**raphical **U**ser **I**nterface ,GUI),用 GUI 學習 Linux 往往會見樹不見林,雲深不知處,沒學習Linux/Unix 的設計哲學和精神。

CLI學習盡量注重在原理而不要去背指令,忘記某指令再去查（man）就好,硬要去記反而會失去興趣。

以文字操作界面為主,圖形操作界面為輔。學會 Linux 的文字操作界面才會驚覺文字操作界面核分裂般的強大威力（所有工具可單獨應用，也可以聯合運作）。

### Shell

文字界面(Command-Line Interface ,CLI)的操作是透過『Shell』與核心 (Kernel)溝通和執行。那什麼是 Shell? 『shell』在英文是『殼』,也就是Linux 的文字操作界面。

<div align="left"><img src="/files/-LtMuP7dhjALfJOaArjG" alt=""></div>

shell 是一文字語言,是一種給 Kernel 看的『**直譯語言**』(Interpreter)。user 在文字界面下所下的指令，是一次一行的透過『Shell Interpreter』(Shell直譯語言)翻譯給 Linux Kernel來進行溝通和執行的。

我們可把很多的文字界面下的指令去配合**迴圈和判斷**等控制變成程式檔案來完成一系列的動作,此種程式就叫『腳本語言』(Script Laguage)。

user 登入文字操作界面時,事實上是使用某一 **shell 直譯語言**來和 Linux 核心溝通。Linux 下 Shell 直譯器語言常見的有 Bourne shell (bash)、 C shell(tcs)、Kom shell(ksh)、zsh 等。

### echo $SHELL 可以查看你所使用的Shell Interpreter

```
echo $SHELL
/bin/bash

```

Linux 真正的威力在於『文字操作界面』(Command Line Interface,CLI)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/andoid-shou-ji/untitled-4/linux-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
