15 Things You Can Do with Windows 10 Bash Shell

You’ve installed and set up Bash on Windows 10. And now it’s time to roll up your sleeves and get down to business, using the Windows Subsystem for Linux to code and develop right on your Windows 10 PC. And now you’re thinking, what exactly can I do with this new shell?

It turns out; there’s a lot you can, and, sadly, a lot you can’t.

  How to Install Linux on Windows 10 using Bash Shell

​Though Microsoft continually rolls out improvements for this side of its operating system, there are certain things that the company is not keen on adding to the Windows Subsystem for Linux — most notably support for graphical Linux desktop applications.

Still, there’s an awful lot of power on offer here, particularly for developers.

Here, we take a look at 15 things you can do with the Windows 10 Bash Shell, from installing Linux software to accessing files between the two environments. Yes, the Windows Subsystem for Linux is still primarily designed with developers in mind, but there’s something for everyone here.

15 Things to do in Windows 10 Bash Shell

#1. Run Multiple Linux Distributions

One of the best things about native Linux on Windows 10 is support for the numerous distributions of the open-source operating system. Initially, only Ubuntu was available. But now it is possible to install openSUSE Leap, SUSE Linux Enterprise Server, Debian GNU/Linux and Kali Linux.

Multiple Linux - 15 Things you can do with Windows 10 Bash Shell

Fedora is reportedly on its way, and it’s a solid bet that you’ll see more distros offered in the future. For the time being, installing multiple Linux distributions at once is easy enough. You can even run various Linux environments at the same time, as each is individually set up from the Microsoft Store.

#2. Run Graphical Linux Desktop Programs

Since we’re on the topic of running, let’s address the elephant in the room. Although there is a lot of demand for this, Microsoft does not officially support running graphical Linux software on Windows. The Windows Subsystem for Linux feature is primarily intended for running command line programs.

GUI Applications - Things to do with Windows 10 Bash Shell

That said, you can run GUI based Linux applications, though they won’t work by default. You’ll need to install an X server and then set the DISPLAY variable. And yes, the simpler the app, the better its chances of running. Complex programs tend to cause stability and usability issues.

#3. Install Linux Software

I mean, that’s why we’re here, right? Installing Linux software on Windows 10 comes down to using the commands for deploying programs on your specific distribution. Ubuntu or Debian environments can use the apt-get command, while openSUSE users can use zypper.

Install Linux Software - Things to do with Windows 10 Bash Shell

But, of course, the advantage of having a full Linux userspace environment like this means that you also get the ability to install applications in any way you see fit. And this includes compiling and installing software from the source code.

#4. Access Windows Files in Bash

And vice versa. The real power of the Windows Subsystem for Linux feature is that it provides a way for you to access your Linux files right from within Microsoft’s OS. These files are typically separated, as both environments have their systems.

Windows Files - 15 Things you can do with Windows 10 Bash Shell

You can access your Windows drives via the /mnt/ folder. For example, your C: drive is at /mnt/c and you can find D: drive with the /mnt/d command. You can manage your files using the /mnt/ folder if you want to work between the two environments.

#5. Access Linux Files in Windows

Linux distributions you install, create a hidden folder that stores all the files used in that environment. You can easily access this folder from within Windows, to view and backup these files, or even create new ones.

Access Linux Files - Things to do on Windows 10 Bash Shell

A word of caution, though. Microsoft warns that you should not modify these Linux files or create new ones here with Windows applications, as doing so may impact the usability of the Bash environment. But as long as you are careful, there should be no issues.

#6. Mount Removable Drives and Network Locations

While the Windows Subsystem for Linux automatically mounts fixed internal drives under the /mnt/ folder, it does not do the same for removable media like USB drives and optical discs. The same goes for any network drives that you have mapped on your PC.

Mount Drives - 15 Things you can do with Windows 10 Bash Shell

However, you can mount both removable drives and network locations using the mount command in Linux. Like your internal drives, these will remain accessible in Windows after you have installed them in your Linux environment. Mounting makes them accessible from within the shell.

#7. Change your UNIX User Account

When first setting up Bash, you are prompted to create a UNIX user account and password. This account is then used to automatically sign you in every time you open the Bash window. If you’d instead use the root account as the default, or change your UNIX user account, there’s a hidden command for that.

Change User Account in Windows 10 Bash Shell

If you’re running Ubuntu, for example, type ubuntu config --default-user username in a Command Prompt or PowerShell window, with your username, of course. So, to set the default user as root, you will need to run the following command, ubuntu config --default-user root.

#8. Create a New User Account in Bash

The excellent old adduser command is all you need to create users accounts in your Linux environment. On Ubuntu, for example, just run the following command replacing the final word with the name of your new user account, sudo adduser username.

Create User Account in Windows 10 Bash Shell

You will be asked to provide the password of the current user account you are using for authentication, along with the password. You may also be asked to provide other information like full name and phone number for your new account. System store this data locally, and you can leave these fields blank.

#9. Use Bash Scripts on Windows

The integration of this new environment in Windows 10 makes it possible for you to write a Bash shell script on Windows and run it. Your Bash scripts can even access your Windows file stored under the /mnt folder, and you can also run standard Windows commands from within the Bash script.

Bash Scripts - 15 Things to do in Windows 10 Bash Shell

You can incorporate the Bash commands into either a Batch or PowerShell script. All this comes in real handy if you’re a professional or power user, as you can effortlessly automate your workloads, speed things up and be more productive using the power of commands.

#10. Run Linux Commands

Want to quickly launch a program, execute a Linux command or run a script? Well, just like on Windows, you can use direct commands to accomplish these tasks, without the need of first launching the Bash environment. Use the bash -c or wsl command to do all this.

Run Linux Commands on Windows 10 Bash Shell

The Linux environment will just run the command then quit. If you run this within a Command Prompt or PowerShell window, you will see the output printed on the consoles. Do keep in mind that Microsoft has deprecated the bash command, so it may not work in the future. But for now, it’s on.

#11. Run Windows Programs

Staring with the Creators Update, you can integrate Windows commands alongside Linux ones in a Bash script. Or, if you want, you can directly run Windows commands from the standard shell you are using to interface with the Windows Subsystem for Linux.

Run Windows Programs in Windows 10 Bash Shell

The process is as simple as typing the path to an .exe file of the program and pressing Enter. The Windows applications you have installed are under the /mnt/c folder in the Bash environment. Be sure to keep capitalization in mind here, as the commands are case sensitive.

#12. Choose your Default Linux Environment

The Microsoft Store handily spells the command you need to launch the Linux environments directly on the download page. They are as simple as typing ubuntu or opensuse-42 for that particular distro. To change your default, you will need to engage with the wslconfig.exe command.

Clean Linux Environment

Type wslconfig /l in Command Prompt or a PowerShell window to view your installed Linux distributions. And to change the default, type wslconfig /setdefault Name, where Name is the name of the Linux distribution like Ubuntu.

#13. Switch to Another Shell

Not a fan of Bash? Then you can quickly switch to any other shell in Windows 10. While Microsoft initially pitched this feature as a Bash Shell environment, the Windows Subsystem for Linux is a compatible layer that lets you run Linux software natively on the operating system.

zsh - 15 Things you can do with Windows 10 Bash Shell

Zsh is the most popular alternative. Install it using the sudo apt-get install zsh command in Ubuntu. And not only can you switch to it, but you can also set things up so that the standard Bash shell automatically turns to Zsh when you open the Linux shell shortcut.

#14. Upgrade your Linux Environment

Since Microsoft now requires that you install Ubuntu and other Linux environments form the Microsoft Store, so store automatically updates your apps to the latest versions without any individual commands or cumbersome processes.

Upgrade Version

If, however, you are using a version of Windows 10 before the Fall Creators Update, then you probably have an older Ubuntu environment installed. Merely open the Store to upgrade and install the newest version of Ubuntu.

#15. Uninstall and Reinstall a Linux Environment

Time for some house cleaning? If you have installed some programs, modified settings and would instead prefer a fresh Linux environment, then you can uninstall it like any other application and reinstall it from the Microsoft Store. Previously, this process was rather complicated, but it is much simpler now.

Installed Distros - 15 Things to do in Bash Shell

Of course, you also have the option of getting a fresh system without redownloading the Linux distribution. It entails running the distribution command alongside clean from a Command Prompt or PowerShell console. As an example, the ubuntu clean command works wonders.

Leave a Comment