如何在 iTerm 中突出显示 IPv4 地址

发布于 2025-01-09 01:47:38 字数 307 浏览 3 评论 0原文

一位朋友最近因为输入错误的 IP 地址而毁掉了一台服务器,我们想:如何才能在日常终端使用中使 IP 地址更清晰。

我们主要在 MacOS 上工作,使用 iTerm 并连接到远程服务器。

它是如何开始的

朋友:我今天不小心毁掉了一台服务器,因为我输错了 IP 地址。哎呀。

我:很抱歉您的损失...

朋友:是否有 iTerm2 设置可以在显示 IP 地址时始终突出显示/着色 IP 地址?

我: 我相信可以做到

A friend recently destroyed a server because he mistyped an IP address, and we thought: how could we make IP addresses clearer to the eye in our day to day Terminal use.

We mostly work from MacOS and use iTerm and connect to remote servers.

How it started

friend: I accidentally today destroyed a server because I mistyped an IP address. Oops.

me: sorry for your loss...

friend: Is there a iTerm2 setting to alwasy highlight/color IP addresses when they are displayed?

me: I believe it can be done

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

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

发布评论

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

评论(1

尬尬 2025-01-16 01:47:38

iTerm 中导航至 Preferences >简介>高级>触发器>编辑并添加此正则表达式 [0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3} )\.([0-9]{1,3}) 然后选择操作突出显示文本突出显示行

确保存在 enable 标志,并选择首选的 Text Background 颜色。

结果:
输入图片此处描述

in iTerm navigate to Preferences > Profiles > Advanced > Triggers > Edit and add this regex [0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}) then select the Action: Highlight Text or Highlight Line.

Make sure the enable flag is present and choose Text Background colors as preferred.

Result:
enter image description here

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