Wanting to run Linux command line under windows usually brings you to one of two options:
- Install WSL (Windows Subsystem for Linux) – the main advantage here is performance optimizations made by Microsoft to take the most advantage of the hardware and OS infrastructure.
- Install Docker for Windows 10 and then create a Linux container which you can run and get the command line prompt from
There are other options such as running a full graphical virtual machine like VirtualBox, VMWare and the like, but our focus will be getting a quick Linux command line prompt from Windows.
My personal preference is using option 2, mainly due to it being easy to install and the ability to easily create multiple sandboxed instances and easily use them for different purposes.
The following describes how to install the latest Ubuntu version and run it as a docker container.
- If you haven’t already done so, install Docker for Windows
- open a command prompt and type:
docker pull ubuntu
- next, type:
copy the image id of the repository named ubuntu
- suppose the image id of the repository you copied was
docker run -it --name=ubuntu-container f6a191f19b5f /bin/sh
- that’s it, you have the root prompt on the latest Ubuntu running on your Windows system!
- After you exit the ubuntu container, you can always enter it again by typing from the command prompt:
docker start -i ubuntu-container