ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Windows上使用Linux命令

2019-12-19 23:03:06  阅读:309  来源: 互联网

标签:universe Windows restricted ubuntu 命令 Linux deb main multiverse


WSL

Windows Subsystem for Linux(简称WSL)是一个在Windows 10上能够运行原生Linux二进制可执行文件(ELF格式)的兼容层。它是由微软与Canonical公司合作开发,其目标是使纯正的Ubuntu 14.04 “Trusty Tahr”映像能下载和解压到用户的本地计算机,并且映像内的工具和实用工具能在此子系统上原生运行。

可以理解为Windows下的Linux子系统

第一步

Win10设置——>windows更新与安全——>开发者选项——>勾选开发人员模式

第二步

控制面板——>程序和功能——>启用和关闭Windows功能——>勾选适用于Linux的Windows子系统

过程中可能会提示你重启

第三步

下载

方式一

Micerossft Store——>bash——>Ubuntu16.04(自己用的)——>安装

方式二
通过命令下载查看官方文档

查看是否成功 win+r 输入bash 就可以了

win10下载Ubuntu16.04 后在win10下具体位置

在文件资源管理输入

方式一

C:\Users\用户名\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu16.04onWindows_79rhkp1fndgsc\LocalState\rootfs

方式二

\wsl$\Ubuntu-16.04

换源

Ubuntu16.04

第一步

先备份原来的源

sudo  cp   /etc/apt/sources.list   /etc/apt/sources.list.bak

第二步

修改sources.list

清除内容修改为

阿里源

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

清华源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

更新软件列表和软件

sudo apt update
sudo apt upgrade

更改外观

由于 WSL 的会话窗口配色实际上取决于 CMD 属性里颜色标签里面的配色,默认的实在是太丑了,既没有高亮字符也不清晰,严重影响开发效率。

这就需要用到一个开源的 CMD 配色工具:ColorTool

管理终端bash

通常 Linux 服务器上面默认使用的 SHELL 是 Bash。其实除了 Bash 之外,还有很多其他的 SHELL 程序,比如:ZSH、CSH、Fish 等等。

在这里不一一说明了

安装zsh参考文档

Hyper(包含了外观和管理)

我个人在用的是Hyper

Hyper 是基于 Electron 的,所以它的插件、主题等等可拓展性都非常强大。几行简单的 Javascript、HTML、 CSS 代码,你就可以定制自己的插件。

在Windows上它是集成在WSL上(高颜值跨平台的终端软件)

去官网直接下载https://hyper.is

如果你是 macOS 平台,你还可以通过 Homebrew 命令来快速完成安装

$ brew cask install hyper

Hyper 本身是支持插件系统的,在安装扩展插件前,你需要先安装 Hyper命令行程序。你可以点击菜单,选择 Plugin 选项,然后点击 Install Hyper CLI command in PATH。

安装插件

$ hyper i vermina

Hyper 的官方主题地址:https://hyper.is/themes

Hyper 的官方插件地址:https://hyper.is/plugins

通常在使用 WSL (Windows Subsystem for Linux) 工作时,我们希望启动终端时就进入 WSL 的 SHELL 内部。但默认情况下我们需要在启动终端并输入 bash 命令后才能进入 WSL 终端。

现在,你只需打开 Hyper 设置页面文件,从菜单 Edit -> Preferences进入,然后编辑 shell 和 shellArgs 参数即可。

修改为

shell: 'C:\\Windows\\System32\\bash.exe',
shellArgs: [],

重新打开 Hyper,你会发现默认已经进入了 Bash 终端界面了。

标签:universe,Windows,restricted,ubuntu,命令,Linux,deb,main,multiverse
来源: https://www.cnblogs.com/xinzaiyuan/p/12070772.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有