工具:如何使用windows terminal+WSL

2024-04-29 20:04

本文主要是介绍工具:如何使用windows terminal+WSL,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

windows terminal + windows subsystem for Linux

近日在使用Cygwin的时候查到原来 巨硬公司已开发Windows terminal工具combine终端,与此同时,通过安装WSL系统,我们可以在window下直接使用Linux,最后将window下安装具有terminal的所有软件都综合到windows terminal下面。

安装 Windows Subsystem for Linux

  • WSL2是windows开发的无需安装虚拟机且与Windows 10共存的Linux系统,一般需要window 10系统(具体版本未查)。安装前需要开启以下功能:
  1. CPU的虚拟机功能,否则在初始化过程会报错;

  2. windows的WSL功能,Windows features选项打开;

  • 完成上述操作后,可通过Microsoft Store搜索Ubuntu安装Ubuntu 20.04或18.04(可以根据自己的喜好下载)。

  • 下载完成后,启动Ubuntu,会出现initialization状态。在初始完成后需要设置root账户名和密码,设置完成后,Windows电脑即拥有了Linux系统了,它与Windows并存。大部分Linux常用的命令均可以在WSL下使用,可作为新手练习或学习Linux,并且它的崩溃不会影响到Windows系统,本人常用来做一些只有root账户才可以操作的命令,比如删库跑路的 rm -rf /* 命令!!!

  • 配置WSL和配置服务器一样,可以修改.bashrc或.bash_profile文件

安装Windows terminal

Windows terminal是Microsoft出品的工具,在GitHub上已有上千颗star了,它有太多太多功能了,这里我只用来作为综合各个terminal的工具。

  • 同样上Microsoft store下载Windows terminal(稳定版本或者preview版本,看自己需求,推荐下载稳定版本),以关键词“terminal”搜索

  • 安装完成后,配置Windows terminal,配置文件是json文件,可通过notepad等工具打开

    1. 配置参数主要有:

      • profiles: 配置每个terminal的guid、路径和颜色背景等等
      • schemes: 颜色背景
      • keybindings: 快捷键设置
    2. 本人参数配置情况: 1.设置了背景图片;2.设置了背景颜色;3.重新调整了terminal顺序;4.添加了新的terminal

      // This file was initially generated by Windows Terminal 1.2.2381.0
      // It should still be usable in newer versions, but newer versions might have additional
      // settings, help text, or changes that you will not see unless you clear this file
      // and let us generate a new one for you.// To view the default settings, hold "alt" while clicking on the "Settings" button.
      // For documentation on these settings, see: https://aka.ms/terminal-documentation
      {"$schema": "https://aka.ms/terminal-profiles-schema",// set default profile: ubuntu"defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",// You can add more global application settings here.// To learn more about global settings, visit https://aka.ms/terminal-global-settings// If enabled, selections are automatically copied to your clipboard."copyOnSelect": true,// If enabled, formatted data is also copied to your clipboard"copyFormatting": true,//customize the colors, font and keyboard bindings"wordDelimiters" : " \\()",    // word delimiters for copy and paste "showTabsInTitlebar" : true,"showTerminalTitleInTitlebar" : true,// A profile specifies a command to execute paired with information about how it should look and feel.// Each one of them will appear in the 'New Tab' dropdown,//   and can be invoked from the commandline with `wt.exe -p xxx`// To learn more about profiles, visit https://aka.ms/terminal-profile-settings"profiles":{"defaults":{"backgroundImage": "C:\\Users\\zouhu\\AppData\\Roaming\\terimal_figure\\goose.png","backgroundImageStretchMode": "uniformToFill","backgroundImageOpacity": 0.6,"background": "#013456","acrylicOpacity": 0.8,"useAcrylic": true,//customize the colors, font and keyboard bindings//"wordDelimiters" : " ./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}~?\u2502",//"showTabsInTitlebar" : true,//"showTerminalTitleInTitlebar" : true},"list": [{"guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}","hidden": false,"name": "Ubuntu-20.04","source": "Windows.Terminal.Wsl","colorScheme": "Monokai Night"},{"guid": "{60af1884-f8af-11ea-adc1-0242ac120002}","hidden": false,"name": "gdl server","commandline": "powershell.exe ssh zouhua@196.168.106.31","colorScheme": "Monokai Night","icon": "C:\\Users\\zouhu\\AppData\\Roaming\\terimal_figure\\SSH.ico"},{// Make changes here to the powershell.exe profile."guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}","name": "Windows PowerShell","commandline": "powershell.exe", "hidden": false,"colorScheme": "Monokai Night"},{// Make changes here to the cmd.exe profile."guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}","name": "Command Prompt","commandline": "cmd.exe","hidden": false,"colorScheme": "Solarized Dark Patched"},{"guid": "{a02de8a8-f4d3-11ea-adc1-0242ac120002}","hidden": false,"name": "git","source": "C:\\Software\\git\\Git\\bin\\bash.exe","colorScheme": "Campbell"},{"guid": "{a7874b94-f4d3-11ea-adc1-0242ac120002}","hidden": false,"name": "cygwin","source": "C:\\Software\\Cygwin\\bin\\mintty.exe","colorScheme": "Monokai Night"},{"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}","hidden": false,"name": "Azure Cloud Shell","source": "Windows.Terminal.Azure","colorScheme": "Monokai Night"}]},// Add custom color schemes to this array.// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes"schemes": [{"name": "Solarized Dark Patched","cursorColor": "#657b83","background": "#002b36","foreground": "#fdf6e3","black": "#073642","blue": "#268bd2","cyan": "#2aa198","green": "#859900","purple": "#d33682","red": "#dc322f","white": "#eee8d5","yellow": "#b58900","brightBlack": "#657b83","brightBlue": "#839496","brightCyan": "#93a1a1","brightGreen": "#586e75","brightPurple": "#6c71c4","brightRed": "#cb4b16","brightWhite": "#fdf6e3","brightYellow": "#657b83"},{"name": "Monokai Night","background": "#1f1f1f","foreground": "#f8f8f8","black": "#1f1f1f","blue": "#6699df","cyan": "#e69f66","green": "#a6e22e","purple": "#ae81ff","red": "#f92672","white": "#f8f8f2","yellow": "#e6db74","brightBlack": "#75715e","brightBlue": "#66d9ef","brightCyan": "#e69f66","brightGreen": "#a6e22e","brightPurple": "#ae81ff","brightRed": "#f92672","brightWhite": "#f8f8f2","brightYellow": "#e6db74"},{"name": "Campbell","cursorColor": "#FFFFFF","selectionBackground": "#FFFFFF","background": "#0C0C0C","foreground": "#CCCCCC","black": "#0C0C0C","blue": "#0037DA","cyan": "#3A96DD","green": "#13A10E","purple": "#881798","red": "#C50F1F","white": "#CCCCCC","yellow": "#C19C00","brightBlack": "#767676","brightBlue": "#3B78FF","brightCyan": "#61D6D6","brightGreen": "#16C60C","brightPurple": "#B4009E","brightRed": "#E74856","brightWhite": "#F2F2F2","brightYellow": "#F9F1A5"}],// Add custom keybindings to this array.// To unbind a key combination from your defaults.json, set the command to "unbound".// To learn more about keybindings, visit https://aka.ms/terminal-keybindings"keybindings":[// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.// These two lines additionally bind them to Ctrl+C and Ctrl+V.// To learn more about selection, visit https://aka.ms/terminal-selection{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },{ "command": "paste", "keys": "ctrl+v" },// Press Ctrl+Shift+F to open the search box{ "command": "find", "keys": "ctrl+shift+f" },// Press Alt+Shift+D to open a new pane.// - "split": "auto" makes this pane open in the direction that provides the most surface area.// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.// To learn more about panes, visit https://aka.ms/terminal-panes{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" },{ "command": { "action": "splitPane", "split": "vertical" }, "keys": "alt+shift+plus" },{ "command": { "action": "splitPane", "split": "horizontal" }, "keys": "alt+shift+-" },//moveFocus{ "command": { "action": "moveFocus", "direction": "down" }, "keys": "alt+down" },{ "command": { "action": "moveFocus", "direction": "left" }, "keys": "alt+left" },{ "command": { "action": "moveFocus", "direction": "right" }, "keys": "alt+right" },{ "command": { "action": "moveFocus", "direction": "up" }, "keys": "alt+up" }, //resizepan { "command": { "action": "resizePane", "direction": "down" }, "keys": "alt+shift+down" },{ "command": { "action": "resizePane", "direction": "left" }, "keys": "alt+shift+left" },{ "command": { "action": "resizePane", "direction": "right" }, "keys": "alt+shift+right" },{ "command": { "action": "resizePane", "direction": "up" }, "keys": "alt+shift+up" },//closePane{ "command": "closePane", "keys": "ctrl+shift+w" }]
      }
    3. PS : 每个人的terminal的GUID都不一样,可以通过使用 在线 UUID生成器完成 Online UUID Generator

  • 最后完成配置的windows terminal

Windows terminal常用的命令

  • 分割屏幕:Alt + shift + d
  • 關閉屏幕:Ctrl + shift + w

这篇关于工具:如何使用windows terminal+WSL的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/947029

相关文章

C语言中联合体union的使用

本文编辑整理自: http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=179471 一、前言 “联合体”(union)与“结构体”(struct)有一些相似之处。但两者有本质上的不同。在结构体中,各成员有各自的内存空间, 一个结构变量的总长度是各成员长度之和。而在“联合”中,各成员共享一段内存空间, 一个联合变量

揭秘未来艺术:AI绘画工具全面介绍

📑前言 随着科技的飞速发展,人工智能(AI)已经逐渐渗透到我们生活的方方面面。在艺术创作领域,AI技术同样展现出了其独特的魅力。今天,我们就来一起探索这个神秘而引人入胜的领域,深入了解AI绘画工具的奥秘及其为艺术创作带来的革命性变革。 一、AI绘画工具的崛起 1.1 颠覆传统绘画模式 在过去,绘画是艺术家们通过手中的画笔,蘸取颜料,在画布上自由挥洒的创造性过程。然而,随着AI绘画工

墨刀原型工具-小白入门篇

墨刀原型工具-小白入门篇 简介 随着互联网的发展和用户体验的重要性越来越受到重视,原型设计逐渐成为了产品设计中的重要环节。墨刀作为一款原型设计工具,以其简洁、易用的特点,受到了很多设计师的喜爱。本文将介绍墨刀原型工具的基本使用方法,以帮助小白快速上手。 第一章:认识墨刀原型工具 1.1 什么是墨刀原型工具 墨刀是一款基于Web的原型设计工具,可以帮助设计师快速创建交互原型,并且可以与团队

Tolua使用笔记(上)

目录   1.准备工作 2.运行例子 01.HelloWorld:在C#中,创建和销毁Lua虚拟机 和 简单调用。 02.ScriptsFromFile:在C#中,对一个lua文件的执行调用 03.CallLuaFunction:在C#中,对lua函数的操作 04.AccessingLuaVariables:在C#中,对lua变量的操作 05.LuaCoroutine:在Lua中,

大学湖北中医药大学法医学试题及答案,分享几个实用搜题和学习工具 #微信#学习方法#职场发展

今天分享拥有拍照搜题、文字搜题、语音搜题、多重搜题等搜题模式,可以快速查找问题解析,加深对题目答案的理解。 1.快练题 这是一个网站 找题的网站海量题库,在线搜题,快速刷题~为您提供百万优质题库,直接搜索题库名称,支持多种刷题模式:顺序练习、语音听题、本地搜题、顺序阅读、模拟考试、组卷考试、赶快下载吧! 2.彩虹搜题 这是个老公众号了 支持手写输入,截图搜题,详细步骤,解题必备

Vim使用基础篇

本文内容大部分来自 vimtutor,自带的教程的总结。在终端输入vimtutor 即可进入教程。 先总结一下,然后再分别介绍正常模式,插入模式,和可视模式三种模式下的命令。 目录 看完以后的汇总 1.正常模式(Normal模式) 1.移动光标 2.删除 3.【:】输入符 4.撤销 5.替换 6.重复命令【. ; ,】 7.复制粘贴 8.缩进 2.插入模式 INSERT

Lipowerline5.0 雷达电力应用软件下载使用

1.配网数据处理分析 针对配网线路点云数据,优化了分类算法,支持杆塔、导线、交跨线、建筑物、地面点和其他线路的自动分类;一键生成危险点报告和交跨报告;还能生成点云数据采集航线和自主巡检航线。 获取软件安装包联系邮箱:2895356150@qq.com,资源源于网络,本介绍用于学习使用,如有侵权请您联系删除! 2.新增快速版,简洁易上手 支持快速版和专业版切换使用,快速版界面简洁,保留主

如何免费的去使用connectedpapers?

免费使用connectedpapers 1. 打开谷歌浏览器2. 按住ctrl+shift+N,进入无痕模式3. 不需要登录(也就是访客模式)4. 两次用完,关闭无痕模式(继续重复步骤 2 - 4) 1. 打开谷歌浏览器 2. 按住ctrl+shift+N,进入无痕模式 输入网址:https://www.connectedpapers.com/ 3. 不需要登录(也就是

问题-windows-VPN不正确关闭导致网页打不开

为什么会发生这类事情呢? 主要原因是关机之前vpn没有关掉导致的。 至于为什么没关掉vpn会导致网页打不开,我猜测是因为vpn建立的链接没被更改。 正确关掉vpn的时候,会把ip链接断掉,如果你不正确关掉,ip链接没有断掉,此时你vpn又是没启动的,没有域名解析,所以就打不开网站。 你可以在打不开网页的时候,把vpn打开,你会发现网络又可以登录了。 方法一 注意:方法一虽然方便,但是可能会有

Windows/macOS/Linux 安装 Redis 和 Redis Desktop Manager 可视化工具

本文所有安装都在macOS High Sierra 10.13.4进行,Windows安装相对容易些,Linux安装与macOS类似,文中会做区分讲解 1. Redis安装 1.下载Redis https://redis.io/download 把下载的源码更名为redis-4.0.9-source,我喜欢跟maven、Tomcat放在一起,就放到/Users/zhan/Documents