當前位置: 首頁>>技術教程>>正文


在遠程連接上自動更改終端顏色?

, ,

問題描述

有沒有辦法在通過 SSH 連接到遠程機器時自動應用終端配置文件?

我想要比每條終端線路上顯示的用戶/主機更明顯的視覺提示,即我已連接到遠程機器。我一天中的大部分時間都連接到多台機器上,這可能會讓人感到困惑。

最佳答案

Srigelsford 來自 Ubuntu 論壇 recommends 這個:

I created several profiles in gnome-terminal with the settings I wanted, then created aliases like the below example to ssh to ares. The Ares profile has a red background.

alias -p ares='gnome-terminal --window-with-profile=Ares -x bash -c "ssh ares"; exit' 

The pitfall of this is that it cannot be done in your existing terminal window, it launches another. My alias closes the existing one after launching the new one, but you can stop that by removing the ; exit from the end.

Just create as many profiles as you like, and associate each server to a profile in an alias. To launch just type the name of the alias $ares

次佳答案

您可以更改遠程係統 shell 配置文件以使用創輝提示,請查看以下鏈接了解詳細信息: http://www.funtoo.org/en/articles/linux/tips/prompt/

參考資料

本文由Ubuntu問答整理, 博文地址: https://ubuntuqa.com/zh-tw/article/12678.html,未經允許,請勿轉載。