U bekijkt het onderwerpartikel [Top] 55 How To Enable Bash for Windows 10 & 11 dat door ons is samengesteld uit vele bronnen op internet.
How To Enable Bash for Windows 10 & 11
Ubuntu Linux Bash for Windows is a powerful tool that enables users to access Unix commands and software without needing to setup a dual-boot system or installing and managing a Virtual Machine. As Microsoft continues to improve support for Windows System for Linux, or WSL, the process for enabling and installing the Ubuntu Bash shell becomes increasingly easy for the user, but it is still not strictly intuitive. Here’s what you need to do.
Step-by-step instructions on how to install Ubuntu Linux Bash in Windows 10
The first step to enabling Bash in Windows 10 & 11 is determining which version of the Windows Subsystem for Linux (WSL) is right for you. While they both provide seamless integration of Linux within Windows, WSL 1 and WSL 2 operate on different architectures and will be beneficial for different use cases.
Which Windows subsystem for Linux (WSL) is right for you?
WSL 1 operates as a compatibility layer, allowing the user to run Linux binary executables on Windows. This layer translates Linux system calls into Windows system calls and then executes them natively within Windows. This architecture requires any updates to the Linux kernel to be implemented separately by Windows which adds additional time to the update process. The translation of commands also causes WSL 1 to suffer from poor I/O (input/output) performance for tasks such as database management, Git operations, and package installation and updates. The key benefit of WSL 1 is the ability to access project files natively in the Windows file system.
WSL 2, on the other hand, is a full Linux kernel operating within a managed Virtual Machine (VM). The kernel is updated during normal Windows updates and is built off the latest stable branch which can be found at kernel.org. The benefits of this architecture include full system call compatibility. This enables applications that were previously impossible to run on WLS 1 due to lack of support from the translation layer, such as Docker.
Not requiring a system call translation significantly speeds up multiple functions leading to a 2-5x speed increase for tasks such as Git clone. A third benefit of this architecture is that Linux kernel updates are immediately available for use and do not need to be implemented in the WSL 1 translation layer then pushed to users. The WSL 2 managed VM environment, unlike a traditional VM, is designed to boot quickly, optimize resource usage, and require no direct user management.
For most users, it is recommended to use WSL 2 due to the increased application compatibility, faster I/O speeds, and quicker kernel update cycles. WSL 1 is recommended only when your project files must be stored in the Windows 10 file system or your project files will require cross-compilation using Windows and Linux tools.
Check your Windows 10 version
Make sure you are running a supported version of Windows 10.
For WSL 1, you need the Windows 10 Fall Creators, Version 1709 or higher, and for WSL 2, you will need to be updated to the May 2020 Update, Version 2004 or higher. Check out this information from Microsoft for more information – What’s the difference between WSL 1 and 2?
To check your version of Windows 10:
- Select Start and then select Settings
- In Settings, select System > About
- Scroll down to Windows Specifications
Alternatively, you can hold the Windows button on the keyboard and tap the R key. Type in “winver”, then press enter.
Note: You won’t need to check what version of Windows you are running if you are running Windows 11, as this software is compatible with all Windows 11 versions.
Enabling Windows subsystem for Linux
Next, you’ll need to enable the Windows Subsystem for Linux. To do this, you will need to open PowerShell as an Administrator and run the command corresponding to your desired WSL version.
To enable WSL 1 run the command:
- dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
For WSL 1 you can now skip to the “Install Ubuntu for Windows 10” step
To enable WSL 2 run the below commands:
- dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
- dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Once your command has successfully completed, restart the operating system.
Install Linux kernel update package
Download the WSL Linux kernel package update for x64 systems. You can download by clicking here.
Run the .msi installer downloaded.
Set WSL 2 as the default version
In powershell, run the command:
- wsl –set-default-version 2
Install Ubuntu for Windows
Ubuntu is available for free from the Microsoft Store:
- In the start menu, type “Microsoft Store” and hit enter. Or click here for the web browser version of the store.
- Search “Ubuntu” and select the top result, “Ubuntu” published by Canonical Group Limited.*
- Click ‘Get’ and follow any further on screen instructions.
The Microsoft Store will handle the download and installation as well as reporting progress.
*At the time this article is being written, Ubuntu 20.04 LTS will be installed following this method. 18.04 can also be found on the Microsoft Store if needed for compatibility purposes.
Launching Ubuntu
With the Microsoft Store installation complete, Ubuntu can now be launched like any other Windows application from the start menu.
On first launch, Ubuntu will notify you that it is installing and to wait for the process to complete. When the installation finishes, you will be prompted to create a new shell username and password.
Note: These credentials do not need to match your windows credentials.
Once complete, and for future launches, you will find yourself at the Bash command line.
Congratulations! You have completed the setup and installation of Ubuntu Linux Bash terminal for Windows 10 & 11!
Note: This blog was originally created on August 1, 2016. It was updated on July 17th, 2022, with updated details.
Get the Latest Tech Updates
Subscribe to our newsletters to get updates from OnLogic delivered straight to your inbox. News and insights from our team of experts are just a click away. Hit the button to head to our subscription page.
Share
More Articles
OnLogic Industrial Computers
Discover OnLogic’s multitude of industrial computers that will help you to advance your IoT project
Learn more at OnLogic.com
OnLogic Industrial PCs: Designed to last. Built to order. Delivered in days. Visit our online store at OnLogic.com
Bekijk hier meer informatie over dit onderwerp: https://dtcbuiding.com/linux-en-windows-liqp4uwx