如何在 CLI 中更改文字顏色?

如何在 CLI 中更改文字顏色?

我已經在 CLI 中以 root 身分啟動,沒有任何 GUI。如何更改文字顏色(前景顏色)?

答案1

在終端機又稱為 CLI(命令列介面)中,已經使用不同的顏色來表示檔案類型、目錄和訊息突出顯示。我不想覆蓋這些顏色。

但是,您可以變更命令提示字元的顏色,這樣可以更輕鬆地區分您鍵入的命令及其輸出。

做這種類型:

gedit ~/.bashrc

然後搜尋該文字區塊:

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

去掉前面的#force_color_prompt=yes並儲存檔案。

我已經在我的系統上完成了此操作並且喜歡結果。

相關內容