Bash Shell只是一个命令行实用程序,长期以来一直是Linux的一部分,现在微软(Microsoft)已直接将其添加到Windows 10中。这既不是虚拟机,也不是任何容器,也不是为Windows编译的任何软件。相反,它是一个完整的Windows 子系统(Windows Subsystem),旨在运行Linux软件,基于Microsoft已停产的用于在Windows上运行Android应用程序的Project Astoria。
现在,我们都知道什么是双模操作系统了。如果您想使用Windows操作系统和Linux操作系统,但您的PC不够强大,无法处理双模操作系统(dual-mode operating systems),您会怎么做?这是否意味着您必须保留两台 PC,一台使用Windows操作系统,另一台使用Linux操作系统?显然不是。
Microsoft使您可以使用双操作系统模式,而无需在您的 PC 中实际安装两个操作系统。微软(Microsoft)与Ubuntu的母公司Canonical合作,宣布现在,您可以使用Bash shell在Windows上运行(Windows)Linux ,即您将能够在Windows上执行(Windows)Linux的所有功能,而无需在您的Linux操作系统中运行个人电脑。
而且,随着Windows 10的升级,在(Windows 10)Windows上获取(Windows)Bash shell变得非常容易。现在,这个问题出现了,如何在 Windows 10 上安装 Linux Bash shell?(how to install the Linux Bash shell on Windows 10?)在本文中,您将得到答案。
如何在 Windows 10 上安装 Linux Bash shell(How to install the Linux Bash shell on Windows 10)
为了在Windows 10上使用(Windows 10)Linux Bash shell ,首先,您必须在Windows 10 上安装 Linux Bash shell( Linux Bash shell on your Windows 10),在安装Bash shell 之前,有一些先决条件。
- 您必须在您的计算机上运行Windows 10周年更新。
- 您必须使用 64 位版本的Windows 10,因为Linux Bash shell 不适用于 32 位版本。
满足所有先决条件后,开始在 Windows 10 上安装Linux Bash shell。
要在Windows 10上安装(Windows 10)Linux Bash shell ,请执行以下步骤:
1. 打开设置(Settings)。
2. 单击更新和安全(Update & Security )选项。
3.从左侧面板的菜单中单击开发人员选项。(Developer options)
4. 在开发者功能下,点击开发者模式(Developer mode)旁边的单选(Radio)按钮。
注意(Note):从Fall Creators Update开始,您无需启用开发者(Developer)模式。直接跳到第 9 步。(Directly skip to step 9.)
5. 将出现一个警告对话框,询问您是否确定要打开开发者模式。单击(Click)是按钮(Yes )。
6. 它将开始安装开发者模式包(Developer Mode package)。
7. 安装完成后,您将收到一条关于打开开发者模式的消息。
8. 重新启动您的电脑。
9. 重新启动 PC 后,打开控制面板(Control Panel)。
10. 单击程序(Programs)。
11. 在程序和功能(Programs and Features)下,单击打开或关闭(features on or off)Windows(Turn Windows) 功能。
12. 将出现以下对话框。
13. 选中 Linux选项的 Windows 子系统(Windows Subsystem for the Linux )(Windows Subsystem for the Linux )旁边的复选框。
14. 单击确定(OK )按钮。
15. 更改将开始应用。请求完成并安装组件后,您需要单击“立即(Now )重新启动(Restart) ”选项重新启动 PC。
16. 系统重启后,您需要安装适用于Windows Subsystem for Linux的(Linux)Ubuntu发行版。
17. 打开命令提示符(Command Prompt)(管理员)并输入以下命令并按Enter:
lxrun /install
注意(Note):从Fall Creators Update开始,您不能再使用“bash”命令安装或使用 Ubuntu。
18. 这将成功安装Ubuntu发行版。现在您只需要设置Unix用户名和密码(可以不同于您的Windows登录凭据)。
19. 完成后,您可以通过打开命令提示符并使用以下命令在 Windows 上使用Bash命令:
bash
替代方案:使用 Microsoft Store 安装 Linux 发行版(Alternative: Install Linux distros using Microsoft Store)
1. 打开微软商店。
2. 现在您可以选择安装以下Linux发行版:
Ubuntu。
OpenSuse Leap
Kali Linux
Debian
Alpine WSL
Suse Linux Enterprise
3. 搜索上述任何Linux发行版,然后单击“安装( Install)”按钮。
4. 在本例中,我们将安装Ubuntu。搜索ubuntu然后单击获取(或安装)(Get (or Install))按钮。
5. 安装完成后,单击启动( Launch)按钮。
6. 您需要为此Linux发行版(Linux)创建用户名和密码(create a username & password)(可以不同于您的Windows用户名和密码)。
7. 现在创建一个新的用户名和密码(new username & password),然后重复密码并再次按Enter确认。
8. 就是这样,现在您可以通过从“开始”菜单启动它来随时使用(Start Menu)Ubuntu发行版。
9. 或者,您可以使用wsl 命令( wsl command)( wsl command. )启动已安装的Linux发行版(Linux)。
如您所知,Windows上的(Windows)Linux Bash shell并不是您在Linux上找到的真正的Bash shell ,因此命令行实用程序有一些限制。这些限制是:
-
适用于 Linux 的 Windows 子系统 (WSL)(Windows Subsystem for Linux (WSL))不是为运行Linux 图形(Linux Graphical)应用程序而设计的。
- 它只会为开发人员提供基于文本的命令行功能来运行Bash。
- Linux应用程序访问系统文件和硬盘驱动器上可用的所有内容,因此您无法在Windows程序上启动或使用脚本。
- 它也不支持后台服务器软件。
- 并非每个命令行应用程序都有效..
微软(Microsoft)正在发布这个带有 beta 标签的功能,这意味着它仍在进行中,并不是每个预期的功能都包括在内,有时它可能无法正常工作。
推荐:(Recommended:) 修复此站点已被您的 ISP 在 Windows 10 中阻止(Fix This Site Has Been Blocked By Your ISP in Windows 10)
但是,随着即将到来的时代和更新,微软(Microsoft)正在寻找使Linux Bash shell 与真正的(Linux Bash)Linux Bash shell相同的方法,方法是专注于其核心功能,如Bash环境,以运行 awk、sed 和 grep 等工具,Linux 用户(Linux user)支持,还有很多。
How To Install Linux Bash Shell On Windows 10
Bash Ѕhell is simply a command-line utility that has been a part of Linυx for a very long time and now, Microsoft has directly added it into Windows 10. Thiѕ is neither a virtual machine nor any container оr any software compiled for Windows. Instead, it is a fυll Windows Subsystem intended for running the Linux software, based on Microsoft’s discontinued Prоjeсt Astoria fоr running Android apps on Windows.
Now, we all know what a dual-mode operating system is. What will you do if you want to use the Windows operating system and the Linux operating system but your PC is not strong enough to handle the dual-mode operating systems? Does it mean you have to keep two PCs, one with the Windows operating system and another with the Linux operating system? Obviously, not.
Microsoft has made it possible to use a dual operating system mode without actually having two operating systems in your PC. Microsoft in partnership with Canonical, which is the parent company of Ubuntu, announced that now, you can run Linux on Windows using a Bash shell i.e. you will be able to perform all the functions of Linux on Windows without having a Linux operating system in your PC.
And, with the up-gradation of Windows 10, it has become very easy to get a Bash shell on Windows. Now, this question arises, how to install the Linux Bash shell on Windows 10? In this article, you will get an answer to this.
How to install the Linux Bash shell on Windows 10
In order to use the Linux Bash shell on Windows 10, first of all, you have to install the Linux Bash shell on your Windows 10, and before installing the Bash shell, there are some prerequisites.
- You must be running the Windows 10 anniversary update on your machine.
- You must be using the 64-bit version of Windows 10 as the Linux Bash shell does not work on the 32-bit version.
Once all the prerequisites are fulfilled, start installing the Linux Bash shell on your Windows 10.
To install the Linux Bash shell on Windows 10, follow these steps:
1. Open the Settings.
2. Click on the Update & Security option.
3. Click on the Developer options from the menu at the left panel.
4. Under the developer features, click on the Radio button next to Developer mode.
Note: Starting with the Fall Creators Update, you don’t need to enable Developer mode. Directly skip to step 9.
5. A warning dialogue box will appear asking if you are sure you want to turn on the developer mode. Click on the Yes button.
6. It will start installing the Developer Mode package.
7. After the installation is finished, you will get a message regarding the developer mode being turned on.
8. Restart your PC.
9. Once your PC is restarted, open the Control Panel.
10. Click on Programs.
11. Under the Programs and Features, click on Turn Windows features on or off.
12. The below dialogue box will appear.
13. Check the checkbox next to Windows Subsystem for the Linux option.
14. Click on the OK button.
15. Changes will start applying. Once the request is completed and the components are installed, you need to restart your PC by clicking on the Restart Now option.
16. Once the system restarts, you need to install the Ubuntu distribution for Windows Subsystem for Linux.
17. Open Command Prompt (admin) and type the following command and hit Enter:
lxrun /install
Note: Starting with the Fall Creators Update, you can no longer install or use Ubuntu by using the “bash” command.
18. This will successfully install the Ubuntu distribution. Now you just need to set up the Unix username and password (which can be different than your Windows login credential).
19. Once finished, you can use the Bash command on Windows by opening the command prompt and using the following command:
bash
Alternative: Install Linux distros using Microsoft Store
1. Open Microsoft Store.
2. Now you have the option to install the following Linux distribution:
Ubuntu.
OpenSuse Leap
Kali Linux
Debian
Alpine WSL
Suse Linux Enterprise
3. Search for any of the above distros of Linux and click on the Install button.
4. In this example, we will install Ubuntu. Search for ubuntu then click on the Get (or Install) button.
5. Once the installation is complete, click on the Launch button.
6. You need to create a username & password for this Linux distribution (which can different than your Windows username & password).
7. Now create a new username & password then repeat the password and again press Enter to confirm.
8. That’s it, now you can use the Ubuntu distro whenever you want by launching it from the Start Menu.
9. Alternatively, you can launch the installed Linux distro by using the wsl command.
As you know, the Linux Bash shell on Windows is not the real Bash shell you find on Linux, so the command line utility has some limitations. These limitations are:
-
Windows Subsystem for Linux (WSL) is not designed to run the Linux Graphical applications.
- It will only offer developers a text-based command-line feature to run Bash.
- Linux applications access the system files and everything that is available on the hard drive so you cannot launch or use the scripts on Windows programs.
- It also does not support background server software.
- Not every command-line application works..
Microsoft is releasing this feature with a beta label on it, which means that it is still in progress, and not every intended feature is included and sometimes it may not work properly.
Recommended: Fix This Site Has Been Blocked By Your ISP in Windows 10
But, with the coming times and updates, Microsoft is finding ways to make Linux Bash shell as same as the real Linux Bash shell by focusing on its core functionalities like Bash environment to run tools like awk, sed, and grep, Linux user support, and many more.