简体   繁体   English

终端配置文件在 SSH 会话中动态更改

[英]Terminal profile dynamically change on SSH sessions

I'm using Gnome Terminal on Ubuntu.我在 Ubuntu 上使用Gnome 终端

When I use a terminal, I would expect to change the colors (profile in Gnome terminal) when I'm connected to a remote host via SSH.当我使用终端时,我希望在通过 SSH 连接到远程主机时更改颜色(Gnome 终端中的配置文件)。

Terminal profile is normal, if I'm SSH somewhere the profile of the terminal should change, If I exit the remote host the terminal come back to normal.终端配置文件正常,如果我在某个地方使用 SSH,终端配置文件应该更改,如果我退出远程主机,终端将恢复正常。

Do you know a simple way to achieve this?你知道实现这一目标的简单方法吗?

PS: On Gnome Terminal you can create profiles but I want them to dynamically change on ssh sessions PS:在 Gnome 终端上,您可以创建配置文件,但我希望它们在 ssh 会话中动态更改

I didn't found a way to dynamically switch between profile on GNOME terminal.我没有找到在 GNOME 终端上的配置文件之间动态切换的方法。

Thanks to this AskUbuntu answer I discovered GNOME Console which is a different project than GNOME Terminal .多亏了这个AskUbuntu 的回答,我发现了GNOME 控制台,它是一个与GNOME 终端不同的项目。

sudo apt install gnome-console

This one satisfies all my needs:这个可以满足我的所有需求:

  • turns red when 'root mode' (sudo/su/pkexec) is active in the terminal当“根模式”(sudo/su/pkexec)在终端中处于活动状态时变为红色
  • turns purple when 'remote mode' (ssh is in use)当“远程模式”(正在使用 ssh)时变为紫色

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM