当您 ssh 到远程系统时,如何在屏幕上显示主机名?
我有各种系统,我经常通过 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将其放入
.bashrc
或.bash_profile
PROMPT_COMMAND='echo -ne "\033k$HOSTNAME\033\\"'
put this in
.bashrc
or.bash_profile
PROMPT_COMMAND='echo -ne "\033k$HOSTNAME\033\\"'
“主机名”命令有效吗?
我怀疑你的解决方案将是特定于终端程序的。你的终端客户端是什么?看看 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/ .