Everything you can do with the new Windows 10 Bash Shell
You can install the Linux environment and the Bash shell on any version of Windows 10. Today's article will summarize what you can do in the new Windows 10 Bash shell.
The Windows 10 Anniversary update has added support for the Linux environment to Windows 10 since 2016. But don't be fooled by this information: It's not just a Bash shell, it's a full compatibility layer. Enough to run Linux applications on Windows.
Today's article will summarize all the things you can do in the new Windows 10 Bash shell for easy tracking.
Everything you can do with the new Windows 10 Bash Shell
- Start with Linux on Windows
- Install Linux software
- Run multiple Linux distributions
- Access Windows files in Bash and Bash files in Windows
- Mount portable drive and network location
- Switch to Zsh (or another Shell) instead of Bash
- Use the Bash script on Windows
- Run Linux commands from outside the Linux shell
- Run Windows programs from Bash
- Run the Linux graphics program on the desktop
- Choose your default Linux environment
- Quickly launch Bash from File Explorer
- Change your UNIX user account
- Uninstall and reinstall the Linux environment
- Upgrade the Ubuntu environment
Start with Linux on Windows
You can install the Linux environment and the Bash shell on any version of Windows 10, including Windows 10 Home. However, it requires 64-bit versions of Windows 10. You just need to enable Windows Subsystem for Linux, then install your selected Linux distribution - for example, Ubuntu - from the Windows Store.
Since the Fall Creators update at the end of 2017, you no longer have to turn on Windows developer mode and this feature is no longer a beta.
Install Linux software
The easiest way to install Linux software in an Ubuntu environment (or Debian) is with the apt-get command . (The apt command also works in this case). This command downloads and installs software from Ubuntu's repositories. You can download and install one or more applications with a single command.
Since this is a user space more or less related to Ubuntu, you can also install the software in other ways. You can compile and install software from source code, just like you would on a Linux distribution.
If you already have another Linux distribution installed, use the commands to install the software on that particular distribution. For example, openSUSE uses zypper command .
Run multiple Linux distributions
Windows 10 previously only supports Ubuntu, the Fall Creators update has enabled support for many Linux distributions. Initially, you can install Ubuntu, openSUSE Leap, SUSE Linux Enterprise Server, Debian GNU / Linux, Kali Linux, or Fedora and we may see many other Linux distributions in the future.
- Instructions for installing Kali Linux on Windows 10 are easier than ever
You can install multiple Linux distributions and even run many different Linux environments at the same time.
If you are not sure which version to install, you should use Ubuntu. However, if you need a specific Linux distribution - you may be testing software that will work on a SUSE Linux Enterprise Server or Debian server, or you want to use security testing tools in Kali Linux - they are available in the Store with Ubuntu.
Access Windows files in Bash and Bash files in Windows
Your Linux files and Windows files are often separated, but there are many ways to access your Linux files from Windows and Windows files from the Linux environment.
The Linux distributions you install will create a hidden folder, in which all the files used in that Linux environment are stored. You can access this folder from Windows if you want, as well as back up Linux files with Windows tools, but Microsoft warns you not to modify these Linux files with Windows tools, or create files New here with Windows applications.
When you are in a Linux environment, you can access your Windows drives from the / mnt / directory . For example, your C: drive is located at / mnt / c and drive D: your is located at / mnt / d. If you want to work with files from within the Linux and Windows environment, place them somewhere in your Windows file system and access them via the / mnt / directory .
Mount portable drive and network location
The Windows Subsystem for Linux feature automatically mounts fixed drives within the / mnt / directory , but it does not automatically mount removable drives such as USB drives and optical drives. It also does not automatically mount any mapped network drives on the PC.
However, you can mount them yourself and access them in a Linux environment with a special mount command, to take advantage of the drvfs file system.
Switch to Zsh (or another Shell) instead of Bash
While Microsoft originally provided this feature as a "Bash shell" environment, it was really a basic compatibility layer, allowing you to run Linux software on Windows. That means you can run other shells instead of Bash, if you like.
For example, you can use Zsh shell instead of Bash. You can even set the standard Bash shell to automatically switch to Zsh shell, when you open the Linux shell shortcut in the Start menu.
Use the Bash script on Windows
Thanks to this environment, it is actually possible to write a Bash shell script on Windows and run it. Bash scripts can access Windows files stored in the / mnt directory , so you can let Linux commands and scripts work on your normal Windows files. You can also run Windows commands from within the Bash script.
You can combine Bash commands into Batch scripts or handy PowerShell scripts.
Run Linux commands from outside the Linux shell
If you just want to quickly start a program, execute a command or run a script, you don't even need to launch the Bash environment first. You can use the bash -c or wsl command to execute a Linux command from outside the Linux shell. The Linux environment just needs to run the command and then exit. If you run this command from within the Command Prompt or PowerShell window, the command will output the Command Prompt or PowerShell control panel.
You can do a lot with bash -c or wsl. You can create desktop shortcuts to launch Linux programs, integrate them into batch scripts or PowerShell, or run them in any other way that you normally run Windows programs.
Run Windows programs from Bash
Since the Creators update (launched in the spring of 2017), you can run Windows programs from within the Linux environment. This means that you can integrate Windows commands with Linux commands in a Bash script, or just run Windows commands from the standard Bash or Zsh shell you are using.
To run Windows program, enter the path to the .exe file and press Enter. You will find your installed Windows programs in the / mnt / c directory in the Bash environment. Remember, this command is case sensitive in Linux, so 'Example.exe' differs from 'example.exe'.
Run the Linux graphics program on the desktop
Microsoft does not officially support Linux graphics software on Windows. The Windows Subsystem for Linux feature is designed to run command line programs that developers may need. But actually it is possible to run Linux graphics programs on Windows desktop with this feature.
However, this will not work by default. You will need to install an X server and set up DISPLAY variables before Linux graphics programs run on your Windows desktop. The simpler the application, the more likely it is to function well. The more complex the application, the more likely it will try to do something that Microsoft's basic Windows Subsystem for Linux does not yet support.
Choose your default Linux environment
If you have installed many Linux distributions, you can choose your default installation. This is the distro used when you launch the Linux distribution using the bash or wsl command, or when you use the bash -c or wsl command to run the Linux command from elsewhere in Windows.
Even if you have installed many Linux distributions, you can still launch them directly by running commands like ubuntu or opensuse-42. The exact command you will need is in every page of Linux distribution downloads in Microsoft Store.
Quickly launch Bash from File Explorer
You do not have to launch Linux shell from its shortcut icon. You can quickly launch it from within File Explorer by typing "bash" into the address bar and pressing Enter. The Bash shell of the default Linux distribution will appear and the current working directory will be the folder you opened in File Explorer.
You can also add the " Open Bash shell here " option to File Explorer by editing the Windows Registry, giving you a convenient context menu option, similar to the " Open PowerShell window here " or " Open Command Prompt here" option. .
Change your UNIX user account
When you set up Bash for the first time, you will be prompted to create a UNIX user account and set a password. You will be automatically logged in with this account every time you open the Bash window. If you want to change your UNIX user account, or use the root account as your default account in the shell, there is a hidden command to change the default user account.
Uninstall and reinstall the Linux environment
After you have installed some programs or changed some settings, you may want to reinstall Ubuntu or another Linux distribution. This was a bit complicated before, but now you can do it simply by uninstalling the Linux distribution, as you would any other application, and then reinstalling it from Store.
To get a new system without downloading the Linux distribution, you can run the distribution command with the "clean" option from the Windows Command Prompt control panel or PowerShell. For example, to reset Ubuntu without reloading it, run ubuntu clean.
If you still have an older Linux environment installed - the environment is installed before the Fall Creators update - you can still uninstall it using the lxrun command .
Upgrade the Ubuntu environment
After the Fall Creators update for Windows 10, you must now install Ubuntu and other Linux environments from Store. When you do that, they will automatically be updated to the latest version without any special commands.
However, if you have created a Bash environment on an older version of Windows, you will install an older Ubuntu environment. You can only open Store and install the latest Ubuntu from Windows Store to upgrade.
Technology enthusiasts will have no doubt about the interesting things they can do with future Linux environments. The Windows Subsystem for Linux feature hopes to continue to become more powerful, but one should not expect Microsoft to officially support Linux graphics applications on the desktop.
See more:
- Ubuntu Bash tutorial on Windows 10
- Instructions for accessing Ubuntu Bash files on Windows
- What are the features of Windows 10 Windows Features?
You should read it
- How to use Zsh (or other Shells) on Windows 10?
- What is 'Bash' in Linux?
- Ubuntu Bash tutorial on Windows 10
- Instructions for accessing Ubuntu Bash files on Windows
- Difference between Zsh and Bash
- How to Install and Run Bash on Windows 11
- How to change user accounts in Ubuntu Bash Shell Windows 10
- How to create and open folders in VS Code with Git Bash for Windows
- Shortcuts to copy - paste coming soon on Windows 10's Bash Console
- What is Linux Shell? The most popular Linux Shells
- 5 example bash scripts to help you learn Linux programming
- Running Linux on Windows 10 does not require a virtual machine, here are 18 things you should know