如何在Windows 10上设置默认Linux发行版

Windows 10 now allows you to install multiple Linux environments, starting with the Fall Creators Update. If you have multiple Linux environments, you can set your default and switch between them.

Windows 10现在允许您从Fall Creators Update开始安装多个Linux环境。 如果您有多个Linux环境,则可以设置默认值并在它们之间切换。

You’re free to run multiple Linux environments at once, but your default environment is used when you run a command like wsl.exe or bash.exe to launch the shell, or when you use wsl [command] or bash -c [command] to run a command from elsewhere in Windows.

您可以自由地一次运行多个Linux环境,但是当您运行诸如wsl.exebash.exe类的命令来启动Shell时,或者当您使用wsl [command]bash -c [command] wsl [command]时,将使用默认环境。 bash -c [command]从Windows的其他位置运行命令。

如何设置默认Linux发行版 (How to Set Your Default Linux Distribution)

The wslconfig.exe command lets you manage the Linux distributions running via the Windows Subsystem for Linux, or WSL.

wslconfig.exe命令使您可以管理通过Windows Subsystem for Linux或WSL运行Linux发行版。

To run it, you need to open either a Command Prompt or PowerShell window. To open a Command Prompt window, open the Start menu, type “cmd”, and then click the “Command Prompt” shortcut. To open a PowerShell window, right-click your Start button (or press Windows+X), and then select the “Windows PowerShell” command.

要运行它,您需要打开命令提示符或PowerShell窗口。 要打开命令提示符窗口,请打开“开始”菜单,键入“ cmd”,然后单击“命令提示符”快捷方式。 要打开PowerShell窗口,请右键单击“开始”按钮(或按Windows + X),然后选择“ Windows PowerShell”命令。

To view your installed Linux distributions, type the following command and hit Enter:

要查看已安装Linux发行版,请键入以下命令,然后按Enter:

wslconfig /l

The Linux distribution ending with “(Default)” is your default Linux distribution.

以“(默认)”结尾Linux发行版是您的默认Linux发行版。

If you don’t see an installed Linux distribution in this list, you’ll first need to launch it. Wait for the “Installing, this may take a few minutes…” process to complete. When it’s done, the Linux distribution will appear in this list.

如果在此列表中没有看到已安装Linux发行版,则首先需要启动它。 等待“安装,这可能需要几分钟……”过程完成。 完成后,Linux发行版将出现在此列表中。

To set your default Linux distribution, run the following command, where Name is the name of the Linux distribution:

要设置默认Linux发行版,请运行以下命令,其中Name是Linux发行版的名称:

wslconfig /setdefault Name

For example, to set Ubuntu as your default Linux distribution, run the following command:

例如,要将Ubuntu设置为默认Linux发行版,请运行以下命令:

wslconfig /setdefault Ubuntu

Now, when you run either the wsl or bash commands, the Linux distribution you selected opens.

现在,当您运行wslbash命令时,将打开您选择Linux发行版。

Your default Linux distribution is also used when you run individual commands with either  wsl command or bash -c command.

当您使用wsl commandbash -c command运行单个命令时,也会使用默认Linux发行版。

如何运行多个Linux发行版 (How to Run Multiple Linux Distributions)

You can run a Linux environment even if it isn’t your default. For example, you can launch the Ubuntu, openSUSE Leap, and SUSE Linux Enterprise Server shortcuts from your Start menu and you’ll have all three separate environments running at the same time.

即使不是默认环境,您也可以运行Linux环境。 例如,您可以从“开始”菜单中启动Ubuntu,openSUSE Leap和SUSE Linux Enterprise Server快捷方式,并且您将同时运行所有三个单独的环境。

To launch a Linux distribution from the command line or via a shortcut, just use its command. The command you need is displayed on the Linux distribution’s page in the Microsoft Store. Here are the commands you’ll need to  launch the three initial three Linux distributions:

要从命令行或通过快捷方式启动Linux发行版,只需使用其命令即可。 所需的命令显示在Microsoft StoreLinux发行版页面上。 这是启动三个最初的三个Linux发行版所需的命令:

  • Ubuntu: ubuntu

    Ubuntu的: ubuntu

  • openSUSE Leap 42: opensuse-42

    openSUSE飞跃42: opensuse-42

  • SUSE Linux Enterprise Server 12: sles-12

    SUSE Linux Enterprise Server 12: sles-12

For example, even if Ubuntu is your default environment, you can still launch openSUSE from anywhere by running the opensuse-42 command.

例如,即使Ubuntu是您的默认环境,您仍然可以通过运行opensuse-42命令从任何地方启动openSUSE。

These commands also work with the same -c switch you can use with the bash.exe command. Just use the below command structure, where “distro-command” is the same command you use to launch the Linux distribution and “command” is the Linux command you want to run.

这些命令还可以与可以与bash.exe命令一起使用的-c开关一起使用。 只需使用以下命令结构,其中“ distro-command”是用于启动Linux发行版的命令,而“ command”是您要运行Linux命令。

distro-command -c command

In other words, even if openSUSE Leap is your default Linux distribution, you can still run a command on Ubuntu from a command-line environment or script just by running ubuntu -c command .

换句话说,即使openSUSE Leap是您的默认Linux发行版,您仍然可以仅通过运行ubuntu -c command环境或脚本在ubuntu -c command运行ubuntu -c command

For example, to run the apt-get moo command that shows an Easter egg on Ubuntu, you’d run the following command:

例如,要在Ubuntu上运行显示复活节彩蛋的apt-get moo命令,请运行以下命令:

ubuntu -c apt-get moo

翻译自: https://www.howtogeek.com/344688/how-to-set-your-default-linux-distribution-on-windows-10/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/279502.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

pjax学习

PJAX 介绍 红薯 发布于 2012/04/11 22:06阅读 61K收藏 116评论 11jQuery.Pjax kissy开发四年只会写业务代码,分布式高并发都不会还做程序员?->>> 介绍 pushState是一个可以操作history的api,该api的介绍和使用请见这里&#xff1a…

SQL Server 2000详细安装过程及配置

说明:这篇文章是几年前我发布在网易博客当中的原创文章,但由于网易博客现在要停止运营了,所以我就把这篇文章搬了过来,虽然现如今SQL Server 2000软件早已经过时了,但仍然有一部分人在使用它,尤其是某些高校…

移动应用ios和网页应用_如何在iOS上一次移动多个应用

移动应用ios和网页应用Apple doesn’t really believe in detailed instruction manuals, so some handy tricks slip through the cracks. One such trick we’ve recently discovered is that you can move multiple app icons at once on iOS. Here’s how. Apple并不真正相…

2018-2019 20165226 Exp9 Web安全基础

2018-2019 20165226 Exp9 Web安全基础 目录 一、实验内容说明及基础问题回答 二、实验过程 Webgoat准备XSS攻击 ① Phishing with XSS 跨站脚本钓鱼攻击② Stored XSS Attacks 存储型XSS攻击③ Reflected XSS Attacks 反射型XSS攻击 CSRF攻击 ① Cross Site Request Forgery(CS…

用 git 同步 Colab 与 Gitlab、Github 之间的文件

Colab 是谷歌提供的免费 Jupyter 服务,可使用 GPU。但由于每次的 VM (虚拟机)登出后所有文件都会连同VM被毁掉。如何将一个项目里的程序或数据同步到 Colab则往往比较麻烦。尽管谷歌盘也可以挂到 Colab 里用&#xff0…

keep-alive使用_如何使用Google Keep进行无忧笔记

keep-alive使用There are a lot of note-taking apps out there. Google Keep may not be as powerful as services like Evernote, but its value is in its simplicity. Let’s talk about how to make the most of it. 那里有很多笔记应用程序。 Google Keep可能不如Evernot…

ZedGraph在项目中的应用

ZedGraph在项目中的应用将数据库数据提取出来,显示成曲线图(饼状、柱状或立体图)是项目中最常见的需求。 网上搜索到的解决方法,大多归为两类,一种是利用ActiveX组件,另一种是使用.net框架自带的画图的类。…

数据安全 数据销毁_如何安全销毁敏感数据CD / DVD?

数据安全 数据销毁You have a pile of DVDs with sensitive information on them and you need to safely and effectively dispose of them so no data recovery is possible. What’s the most safe and efficient way to get the job done? 您有一堆DVD,上面有敏…

动态切换父元素隐藏和显示里面的子元素的动画会再一次执行吗?

代码&#xff1a;完整代码:<!DOCTYPE html> <html> <head> <meta charset"UTF-8"> <title></title> <style type"text/css"> *{ margin: 0; padding: 0; } .box{ background-color: #00B83F; } .flag{ position…

MAD huashi

name1 input("请输入一个名字") name2 input("请输入一个名词") name3 input("请输入一个形容词") name4 input("请输入一个名字") name5 input("请输入一个名字") name6 input("请输入一个长辈名字") name…

如何使用QuickConnect远程访问Synology NAS

Your Synology NAS includes a QuickConnect feature that lets you access its DiskStation Manager interface remotely. Here’s how to set it up. Synology NAS包含快速连接功能&#xff0c;可让您远程访问其DiskStation Manager界面。 设置方法如下。 You were likely gr…

网络编程介绍

1. 目标:编写一个C/S架构的软件 C/S: Client--------基于网络----------Server B/S: Browser-------基于网络----------Server2. 服务端需要遵循的原则: 1. 服务端与客户端都需要有唯一的地址,但是服务端的地址必须固定/绑定 2. 对外一直提供服务,稳定运行 3. 服…

css段落缩进_如何缩进Google文档中的段落

css段落缩进Indenting paragraphs in Google Docs requires access to the ruler, which you’ll only find in the full web version. The ruler is not present in the mobile apps. 在Google文档中缩进段落需要访问标尺&#xff0c;而标尺只能在完整的网络版本中找到。 标尺…

暑假个人小结

今天。。。不&#xff0c;是昨天&#xff0c;聂老大让我们写暑期总结 其中有这么一个 &#xff08;300字啊。。。我得好好想想怎么编&#xff09; 嘛&#xff0c;在这写点不敢交上去的内容吧。 7月总结 我收获了什么 很多课件 两个qq群 slay.one被人虐 联盟无畏先锋的号到了20级…

php-fpm with php-5.3.2 + APC

php-fpm 现在php官方内部已经出版本了&#xff0c;据说以后会出现在 php core 里&#xff0c;如果现在安装的话&#xff0c;可以svn得到最新代码,我抢先为快。 至于缓存&#xff0c;我用的facebook 试用的apc 测试了一段时间还很&#xff0c;满意。wget ftp://ftp.csx.cam.ac.u…

kotlin 初始化数组

为什么80%的码农都做不了架构师&#xff1f;>>> //初始化5个元素的数组&#xff0c;每个都为"0" val a:Array<String> Array(5, {"0"}) // val a:Array<String> Array(5, {"0"}) println(a.joinToString(separator &…

Tomcat - Tomcat安装

Tomcat官网&#xff1a;http://tomcat.apache.org/ 准备&#xff1a;JAVA环境布置完成 一、Windows平台 1. 版本选择 1&#xff09; 进入官网 2&#xff09; 查看版本匹配 官网说明 https://tomcat.apache.org/whichversion.html 3&#xff09; 需要查看已安装JAVA版本请打开终…

sonos 服务器_如何在Sonos上收听有声读物

sonos 服务器Audible, Amazon’s subscription audiobook service, was conspicuously absent from Sonos for the last few years. Thankfully, it’s now back. Here’s how to use it. 过去几年&#xff0c;Sonos明显缺少Amazon的订阅有声读物服务Audible。 幸运的是&#x…

SQL Server Management Studio清除历史登陆记录

今天做渗透,登陆目标服务器的数据库管理后发现留下了登陆的记录,自己鼓捣了半天,终于解决 删除C:\Documents and Settings\guest\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell下的 mru.dat文件就可以了 本文转sinojelly51CTO博客&#xff0c;原文链接&…

停止抱怨英语_停止抱怨垂直视频

停止抱怨英语People have strong feelings about which direction video should be oriented. There are good reasons for that, but in some contexts, vertical video is completely fine and you should stop complaining about it. 人们对视频应该定向哪个方向有着强烈的感…