当您 ssh 到远程系统时,如何在屏幕上显示主机名?

发布于 2024-12-28 17:36:26 字数 204 浏览 7 评论 0原文

我有各种系统,我经常通过 ssh 进入。问题是,有时我忘记了 ssh 进入的主机名。一直检查主机名有点乏味。是否可以在 screen 中显示主机名(我使用 screen ssh 到远程计算机)。

例如

$screen  
$ssh hostname.com

,在 i ssh 之后,在我的屏幕中显示当前主机名。

I have various systems to which i regularly ssh into . The problem is , at some point of time i forget the hostname into which i have ssh into. Its kinda tedious to keep checking hostname all the time. Is it possible to display the hostname in screen ( i use screen to ssh into remote machines ) .

For example

$screen  
$ssh hostname.com

after i ssh , in my screen the current hostname is displayed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

丑疤怪 2025-01-04 17:36:26

将其放入 .bashrc.bash_profile

PROMPT_COMMAND='echo -ne "\033k$HOSTNAME\033\\"'

put this in .bashrc or .bash_profile

PROMPT_COMMAND='echo -ne "\033k$HOSTNAME\033\\"'

攒一口袋星星 2025-01-04 17:36:26

“主机名”命令有效吗?

我怀疑你的解决方案将是特定于终端程序的。你的终端客户端是什么?看看 http://kpumuk.info/mac-os-x/how-to-show-ssh-host-name-on-the-iterms-background/

Does the "hostname" command work?

I suspect your solution will be terminal program specific. What is your terminal client? Take a look at http://kpumuk.info/mac-os-x/how-to-show-ssh-host-name-on-the-iterms-background/ .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文