Try   HackMD

Notes:Windows Terminal 微軟終端機設定

微軟終端機可以讓命令提示字元 CMD、Linux 子系統 WSL、Anaconda Prompt 跟遠端 ssh 連接的 server 整併在同一個終端機頁籤中,設置好之後就不用到處找特定終端機路徑要在哪裡開。以下筆記一下怎麼設定。

Step 1. 下載微軟終端機(Windows Terminal)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

打開微軟商店(Windows Store)搜尋關鍵字「Terminal」下載後打開。
也可以從這邊直接下載:Windows Terminal Download

Step 2. 設定預設

設定可以在標籤最右邊的小三角中下拉打開,預設可以在〔設定 > 預設設定檔〕的地方修改,這邊已經裝好了 Linux 子系統的 Ubuntu-20.04,所以以後打開這個終端機都會先開啟 Ubuntu 的 CLI 畫面。

如果要安裝微軟適用的 Linux 子系統,安裝可以參考這篇:
WSL:在 Win10 安裝適用 Linux 的子系統

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Step 3. 設定終端機要開啟的路徑

Ubuntu 20.04 WSL

wsl 的啟動路徑會是這樣(視 Ubuntu 版本更改後綴):

wsl.exe -d Ubuntu-20.04

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Miniconda Prompt

只要在電腦中找到 miniconda prompt 的 exe 執行檔之後右鍵 > 內容 > 複製〔目標〕欄位上的路徑,回到微軟終端機的﹝命令列﹞上按貼上就好。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

選擇開啟 anaconda prompt 的檔案位置,然後在 prompt 的 exe 執行檔右鍵 > 內容 > 複製〔目標〕路徑。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

回到微軟終端機的﹝設定 > 一般 > 命令列﹞上按貼上,我電腦裡的路徑是這樣(視使用者名稱、miniconda的安裝位置會有差別)

%windir%\System32\cmd.exe "/K" C:\Users\user\miniconda3\Scripts\activate.bat C:\Users\user\miniconda3

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

iServe 國網台灣杉一號、三號

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

這為的是不想打開 putty 來連國網設置好就能直接從微軟終端機 ssh 連上去,不用打開 putty 了。

台灣杉一號

ssh <主機帳號名>@clogin1.twnia.nchc.org.tw

台灣杉三號

ssh <主機帳號名>@t3-c1.nchc.org.tw

這樣在終端機開啟台灣杉標籤的時候會直接詢問你國網 password 如圖:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

(Optional)想要即時迅速查看國網的 MOTP 可以安裝 Chrome的擴充插件 - Authenticator 設定好國網 MOTP 的QR CODE 就可以從瀏覽器旁邊立刻看到當前的 MOTP 了。

Step 4. 其他

外觀上都可以自行調整,Windows Terminal 的可以個人化的範圍很廣,也可以藉由設定畫面最左下角〔開啟 JSON 檔案〕的部分做更細節的設定檔編寫,包含快捷鍵也可以自定義,非常方便美觀。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


: : 20220330 : : 與松 withhhsong : :

tags: withhhsong notes terminal