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: Windows 10 bash help

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: Windows 10 bash example

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.

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

  1. staiki

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

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      Иксы нужны и какой-нить fluxbox.
      Вот тут я калькулятор запускал:
      https://winaero.com/blog/how-to-run-linux-gui-apps-on-windows-10-in-bash/

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *