How to install and run Bash on Ubuntu on Windows 10

Windows 10 Anniversary Update users can now install and run Bash on Ubuntu on Windows. Microsoft’s new “Windows Subsystem for Linux” in Windows 10 enables this new feature.

Of course, there are some limitations like it won’t work with server software and graphical software. Bash on Windows is best for developers who want to run Linux command-line utilities on Windows machines. To install Bash on Windows 10, you will need Anniversary Update.

How to install Bash on Ubuntu on Windows 10

  • Open the Settings app and go to Update & Security > For Developers, now select Developer Mode option.
  • Open Control Panel and click Programs, under Programs and Features click Turn Windows Features On or Off. Scroll down and select Windows Subsystem for Linux (Beta) option and click “OK.”

Turn Windows Features On or Off

  • Now reboot your computer.
  • After your computer restarts, press Windows Key + R and type bash, now press OK.
  • Press ‘Y‘ and accept the terms of service. This will download and install Bash on Ubuntu on Windows.

Bash on Ubuntu on Windows

  • Finally, you will need to create a new user account and password for the Bash environment.

However, you can also run the following command. This will agree to all prompts and set the default user to “root” with no password.

lxrun /install /y

How to Use Bash on Ubuntu on Windows and Install Linux Software

You’ll now have a full Bash shell based on Ubuntu. Also, you can use Ubuntu’s apt-get command to install software. You’ll have access to all the Linux command line software out there.

Click Start and click “Bash on Ubuntu on Windows” application.

If you have used Bash shell before on Linux or other platforms, you’ll be right at home. You’re given a root shell, so now you don’t need to use sudo. Your Windows file system is located at /mnt/c.

Check out few basic commands on both Windows and Bash:
  • Change Directory: cd in Bash, cd or chdir in DOS
  • List Contents of Directory: ls in Bash, dir in DOS
  • Move or Rename a File: mv in Bash, move and rename in DOS
  • Copy a File: cp in Bash, copy in DOS
  • Delete a File: rm in Bash, del or erase in DOS
  • Create a Directory: mkdir in Bash, mkdir in DOS
  • Use a Text Editor: vi or nano in Bash, edit in DOS

To install and update the Ubuntu software, you’ll need to use the apt-get command. Here are the apt-get commands you’ll need to know:

  • Download information about available packages: sudo apt-get update
  • Install an application: sudo apt-get install packagename (Replace “packagename” with the package’s name.)
  • Uninstall an application: sudo apt-get remove packagename (Replace “packagename” with the package’s name.)
  • Search for available: sudo apt-cache search word (Replace “word” with a word you want to search)
  • Download and Install the Latest Versions of Your Installed Packages: sudo apt-get upgrade

Uninstall and Reinstall the Ubuntu on Windows 10

If you want to uninstall and reinstall the Ubuntu environment, you need to use lxrun command. The lxrun command allows you to remove installed Linux system files. Also, lxrun command can also be used to install the Linux environment.

SHARE