Run Linux commands from cmd.exe prompt in Windows 10

As you may already know, Windows 10 Anniversary Update comes with a Bash on Ubuntu console, which allows the user to access and launch Ubuntu apps on Windows. Targeted for console apps and services, it allows you to run even GUI apps with a trick. In this article, we will see how to run a Linux command from the cmd.exe prompt in Windows 10 directly.

You can omit the need for a separate console for Bash on Ubuntu in Windows 10 and run a specific command or a set of commands directly from the command prompt. This is possible thanks to the implementation of Bash on Ubuntu.
The bash console can be started via the following file:

c:\windows\system32\bash.exe

This is a console app, which supports a number of command line arguments. You can learn them by running

bash --help

The output is as follows:

As is apparent from the brief help it provides, you can call a Linux command directly using the following syntax:

bash -c "linux command here"

The following example demonstrates this ability:

Watch the following video to see this trick in action:

Tip: You can subscribe to Winaero at Youtube.

That's it. Now you can extend your command line scripts with Linux apps.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

3 thoughts on “Run Linux commands from cmd.exe prompt in Windows 10”

  1. apt-get install nautilus – тоже работает но не могу понять как запустить оболочку…

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.