当前位置: 首页>>技术教程>>正文


在远程连接上自动更改终端颜色?

, ,

问题描述

有没有办法在通过 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/article/12678.html,未经允许,请勿转载。