iTerm 能定义 title 吗,服务器比较多。有时候开一堆窗口之后就不知道哪个是连的哪个服务器了

2017-01-12 14:20:51 +08:00
 imherer
6157 次点击
所在节点    MacBook Pro
48 条回复
ynyounuo
2017-01-12 14:56:39 +08:00
用 badge
imherer
2017-01-12 15:42:40 +08:00
@ynyounuo 能具体点吗?不知道什么意思。
qce7
2017-01-12 15:46:13 +08:00
屏幕右上角的一个半透明文字显示
https://www.iterm2.com/documentation-badges.html
imherer
2017-01-12 16:09:14 +08:00
@qce7 这个好啊,不过还有问题请教下。我把登陆信息都配置在~.ssh/config 文件里的,我都说通过别名登陆的。这个应该怎么配置呢。
我通过 ssh user@hostname 这样登陆,配置\(session.username)@\(session.hostname)这样还是显示不出来呢
imherer
2017-01-12 16:12:55 +08:00
@qce7 哦,是 Shell Integration 没安装、我装下试试、
loserwn
2017-01-12 16:32:14 +08:00
每个环境还要装一下 Shell Integration
imherer
2017-01-12 16:47:07 +08:00
@loserwn 什么意思?服务器上也得装 Shell Integration 吗? 我在 Mac 上装了 Shell Integration 但是读出来的是我 Mac 的 username 和 hostname ,但是我是想显示服务器的
imherer
2017-01-12 16:50:33 +08:00
@loserwn 果然,每个服务器都得装,显示出来的也不是我想要的。 我是想显示我~.ssh/config 里的别名就好了
fityme
2017-01-12 17:06:34 +08:00
为嘛不用 tmux ?
imherer
2017-01-12 17:25:55 +08:00
@fityme tmux 这个能满足的我需求吗? 我试试
tairan2006
2017-01-12 17:26:40 +08:00
这个问题正确的解决办法是给每个服务器启一个方便识别的名字。。
est
2017-01-12 17:31:09 +08:00
~/.bash_profile 里这样写

ssh ()
{
echo -ne "\033k$1\033\\";
ssh $@
}
imherer
2017-01-12 17:36:12 +08:00
@tairan2006 我有在~./ssh/config 里给每个服务器起别人,连接的时候直接 ssh+别名行了,关键是连接成功之后, title 就变成了 username@服务器的内外 ip 了,这样一来,连的服务器多了,就不知道哪个是哪个了
imherer
2017-01-12 17:36:41 +08:00
@tairan2006 内网 ip 。。。打错了
imherer
2017-01-12 17:37:16 +08:00
@est 谢谢,有点看不懂。 我研究研究。
est
2017-01-12 17:38:44 +08:00
@imherer 编辑 ~/.bash_profile 粘贴那段代码到最后,然后保存退出,然后新开一个,注意是新开一个 终端,然后 ssh 试试
fityme
2017-01-12 17:39:05 +08:00
@imherer tmux 可以给每个 tab 自定义名字的,想叫什么都可以,想自动设置成某个名字的话得自己 hack 一下
imherer
2017-01-12 17:39:06 +08:00
@est 写了,好像没发现和之前有什么不用呢
imherer
2017-01-12 17:41:38 +08:00
@est 敲下 ssh 命令回车之后。 title 确实变成别名了,不过过 1 , 2 秒窗口直接关掉了。
est
2017-01-12 17:56:44 +08:00
@imherer 什么叫 窗口直接关掉了?窗口自动关闭?


这个是 ANSI 标准改窗口标题。我用了快 10 年了。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/334119

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX