使用 Windows Terminal 连接远程主机

2021-03-03 12:25

阅读:378

标签:reference   set   路径   The   网络   def   bbb   运算   title   

使用 Windows Terminal 连接远程主机

Intro

Windows Terminal 是微软新推出来的一个全新的、流行的、功能强大的命令行终端工具。包含很多来社区呼声很高的特性,例如:多 Tab 支持、富文本、多语言支持、可配置、主题和样式,支持 emoji 和基于 GPU 运算的文本渲染等等。同时该终端依然符合我们的目标和要求,以确保它保持快速、高效,并且不会消耗大量内存和电源。

在前几天的微软开发者 Build 大会上, Windows Terminal 发布了 1.0 正式版,可以从微软的应用商店进行下载,之前一直用的 XShell 去管理远程 Linux 主机,用上 Terminal 之后就放弃了 XShell,直接使用 ssh 了,如果你还未开始使用 Windows Terminal ,强烈建议你尝试一下,也许你会爱不释手~

使用一览

技术图片

技术图片

技术图片

上面的截图中后面选项三个都是我手动添加 Profile,都是 Linux 主机,使用时只需要点击一下,输入密码即可登录远程主机,然后就可以在你的远程主机上尽情玩耍了~~

Windows Terminal 配置文件

技术图片

配置指南可以参考微软的官方文档 https://aka.ms/terminal-documentation/https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingJsonSettings.md

Github 上的开源主题分享:https://github.com/atomcorp/themes https://atomcorp.github.io/themes/

如果你之前用的 XShell 之类的终端工具喜欢使用 Shift + Insert 来粘贴文本的话也可以配置快捷键来实现,使之更符合自己的使用习惯,默认是 Ctrl+Shift+C 复制,Ctrl+Shift+V 粘贴

新建远程主机 Profile

新建的 Profile 示例配置如下:

{
    "name": "weihanli.xyz", // 会显示在 Tab 的下拉选项中
    "tabTitle": "pipeline@weihanli.xyz", // 打开后的 Tab 标题
    "colorScheme" : "AdventureTime", // 颜色主题,与下面定义的 schemes 中的主题的名称对应
    "commandline": "ssh pipeline@weihanli.xyz", // 执行的命令
    "icon": "C:\\Users\\liweihan\\Pictures\\Saved Pictures\\7604648.jpg" //图标路径,不仅支持本地路径还支持网络图标
}

技术图片

这里我是不需要设置为默认打开的 profile 所以没有配置 guid,如果需要配置为默认打开的 profile,则需要添加一个唯一的 guid ,然后修改上面的 defaultProfile 的值为新添加的 profile 的 guid 即可

颜色主题配置:

颜色主题我是从 https://atomcorp.github.io/themes/ 这里找了几个觉得还不错的主题,可以在这里找自己喜欢的主题,然后再加一些自定义的配置调整,我的颜色主题配置如下:

// Add custom color schemes to this array
// https://atomcorp.github.io/themes/
"schemes":
[
    {
        "name": "AdventureTime",
        "black": "#050404",
        "red": "#bd0013",
        "green": "#4ab118",
        "yellow": "#e7741e",
        "blue": "#0f4ac6",
        "purple": "#665993",
        "cyan": "#70a598",
        "white": "#f8dcc0",
        "brightBlack": "#4e7cbf",
        "brightRed": "#fc5f5a",
        "brightGreen": "#9eff6e",
        "brightYellow": "#efc11a",
        "brightBlue": "#1997c6",
        "brightPurple": "#9b5953",
        "brightCyan": "#c8faf4",
        "brightWhite": "#f6f5fb",
        "background": "#1f1d45",
        "foreground": "#f8dcc0"
    },
    {
        "name": "Atom",
        "black": "#000000",
        "red": "#fd5ff1",
        "green": "#87c38a",
        "yellow": "#ffd7b1",
        "blue": "#85befd",
        "purple": "#b9b6fc",
        "cyan": "#85befd",
        "white": "#e0e0e0",
        "brightBlack": "#000000",
        "brightRed": "#fd5ff1",
        "brightGreen": "#94fa36",
        "brightYellow": "#f5ffa8",
        "brightBlue": "#96cbfe",
        "brightPurple": "#b9b6fc",
        "brightCyan": "#85befd",
        "brightWhite": "#e0e0e0",
        "background": "#161719",
        "foreground": "#c5c8c6"
    },
    {
        "name": "cyberpunk",
        "black": "#000000",
        "red": "#ff7092",
        "green": "#00fbac",
        "yellow": "#fffa6a",
        "blue": "#00bfff",
        "purple": "#df95ff",
        "cyan": "#86cbfe",
        "white": "#ffffff",
        "brightBlack": "#000000",
        "brightRed": "#ff8aa4",
        "brightGreen": "#21f6bc",
        "brightYellow": "#fff787",
        "brightBlue": "#1bccfd",
        "brightPurple": "#e6aefe",
        "brightCyan": "#99d6fc",
        "brightWhite": "#ffffff",
        "background": "#332a57",
        "foreground": "#e5e5e5"
    },
    {
        "name": "Flat",
        "black": "#222d3f",
        "red": "#a82320",
        "green": "#32a548",
        "yellow": "#e58d11",
        "blue": "#3167ac",
        "purple": "#781aa0",
        "cyan": "#2c9370",
        "white": "#b0b6ba",
        "brightBlack": "#212c3c",
        "brightRed": "#d4312e",
        "brightGreen": "#2d9440",
        "brightYellow": "#e5be0c",
        "brightBlue": "#3c7dd2",
        "brightPurple": "#8230a7",
        "brightCyan": "#35b387",
        "brightWhite": "#e7eced",
        "background": "#002240",
        "foreground": "#2cc55d"
    },
    {
        "name": "Galaxy",
        "black": "#000000",
        "red": "#f9555f",
        "green": "#21b089",
        "yellow": "#fef02a",
        "blue": "#589df6",
        "purple": "#944d95",
        "cyan": "#1f9ee7",
        "white": "#bbbbbb",
        "brightBlack": "#555555",
        "brightRed": "#fa8c8f",
        "brightGreen": "#35bb9a",
        "brightYellow": "#ffff55",
        "brightBlue": "#589df6",
        "brightPurple": "#e75699",
        "brightCyan": "#3979bc",
        "brightWhite": "#ffffff",
        "background": "#1d2837",
        "foreground": "#ffffff"
    },
    {
        "name": "Tomorrow",
        "black": "#000000",
        "red": "#c82829",
        "green": "#718c00",
        "yellow": "#eab700",
        "blue": "#4271ae",
        "purple": "#8959a8",
        "cyan": "#3e999f",
        "white": "#ffffff",
        "brightBlack": "#000000",
        "brightRed": "#c82829",
        "brightGreen": "#718c00",
        "brightYellow": "#eab700",
        "brightBlue": "#4271ae",
        "brightPurple": "#8959a8",
        "brightCyan": "#3e999f",
        "brightWhite": "#ffffff",
        "background": "#ffffff",
        "foreground": "#4d4d4c"
    },
    {
        "name": "Tomorrow Night",
        "black": "#000000",
        "red": "#cc6666",
        "green": "#b5bd68",
        "yellow": "#f0c674",
        "blue": "#81a2be",
        "purple": "#b294bb",
        "cyan": "#8abeb7",
        "white": "#ffffff",
        "brightBlack": "#000000",
        "brightRed": "#cc6666",
        "brightGreen": "#b5bd68",
        "brightYellow": "#f0c674",
        "brightBlue": "#81a2be",
        "brightPurple": "#b294bb",
        "brightCyan": "#8abeb7",
        "brightWhite": "#ffffff",
        "background": "#1d1f21",
        "foreground": "#c5c8c6"
    },
    {
        "name": "Tomorrow Night Blue",
        "black": "#000000",
        "red": "#ff9da4",
        "green": "#d1f1a9",
        "yellow": "#ffeead",
        "blue": "#bbdaff",
        "purple": "#ebbbff",
        "cyan": "#99ffff",
        "white": "#ffffff",
        "brightBlack": "#000000",
        "brightRed": "#ff9da4",
        "brightGreen": "#d1f1a9",
        "brightYellow": "#ffeead",
        "brightBlue": "#bbdaff",
        "brightPurple": "#ebbbff",
        "brightCyan": "#99ffff",
        "brightWhite": "#ffffff",
        "background": "#002451",
        "foreground": "#ffffff"
    }
]

More

从上面我们可以看的出来,其实可以玩的有很多,

命令可以根据自己的需要进行定制,上面是连接一个远程的Linux主机,我们也可以通过 powershell 连接远程的 Windows 主机,也可以打开在某一个位置打开固定的 shell 等等,

主题可以高度自定义,除了上面的几个主题用到的颜色,前景色,背景色之外还可以针对 profile 配置背景图透明度等

快捷键绑定自定义,可以让你的使用习惯一如往常

总之,如果你还没有用上 Windows Terminal ,强烈建议使用一下,感受一下全新的命令行终端

Reference

  • https://aka.ms/terminal-documentation
  • https://github.com/microsoft/terminal
  • https://github.com/microsoft/terminal/blob/master/doc/user-docs/UsingJsonSettings.md
  • https://github.com/kerol2r20/Windows-terminal-context-menu
  • https://github.com/atomcorp/themes
  • https://www.zhihu.com/question/37181941/answer/695147545

使用 Windows Terminal 连接远程主机

标签:reference   set   路径   The   网络   def   bbb   运算   title   

原文地址:https://www.cnblogs.com/weihanli/p/12989147.html


评论


亲,登录后才可以留言!