Bash on Windows - Step by step

I would like to share with you the step-by-step about how to use the Bash on Windows 10.

 

The "Bash on Ubuntu on Windows" is available on the anniversary version of Windows 10 (version 1607).

 

bash01

 

To enable the feature, you need to configure Windows 10 to receive updates to the developer mode (Settings / Update & Security / For developers / Developer mode).

 

bash02

 

After receiving updates, Linux subsystem is available to be activated as a Windows feature. One way to enable the feature, is using the shortcut Windows Key + X :

 

bash03

 

To run the Bash, just type "Bash on Ubuntu on Windows" in the Windows Start menu. The following prompt will be displayed:

 

bash04

 

Here are some useful commands.

 

To clean the screen:

 

clear

To list the files and directories:

ls

To create or edit a file:

 

vi

For example:

 

vi demo.txt

In the vi editor, press i to start the edit mode. Press ESC to return to the command menu. Type ZZ to save the file or :q to close the editor.

 

bash05

 

To display the file content on prompt:

 

cat

For example:

 

cat demo.txt

bash07

 

To search for a string within a file:

 

grep

 

For example:

 

grep Bash demo.txt

bash08

To list the processes running on Bash:

top

bash09
To connect to a remote machine:

sudo ssh IPADDRESS -l user

I hope you have enjoyed it.