Bash shell via Git Bash or WSL in Windows

  • Thread starter Thread starter fog37
  • Start date Start date
Click For Summary
SUMMARY

The discussion clarifies the differences between Git Bash and Windows Subsystem for Linux (WSL) as methods to access the Bash shell on Windows. Git Bash is a standalone program that provides a terminal interface for executing Unix Bash commands, while WSL allows for a more integrated experience by enabling Linux programs to run natively on Windows. WSL2, unlike WSL1, operates as a lightweight virtual machine, offering enhanced compatibility for Linux applications. Users seeking to run Docker on Windows must install WSL2 for optimal functionality.

PREREQUISITES
  • Understanding of Windows CMD and PowerShell functionalities
  • Familiarity with Bash commands and Unix-like environments
  • Knowledge of Windows Subsystem for Linux (WSL) versions
  • Basic concepts of virtualization and how WSL2 differs from WSL1
NEXT STEPS
  • Explore the installation and configuration of WSL2 on Windows
  • Learn about Docker installation and usage within WSL2
  • Investigate the differences between WSL1 and WSL2 for Linux application compatibility
  • Review advanced Git Bash commands and their applications in Windows
USEFUL FOR

Windows developers, system administrators, and anyone interested in utilizing Bash commands and Linux applications within a Windows environment.

fog37
Messages
1,566
Reaction score
108
Hello,
I understand that, in Windows, there are two native shells which are the programs CMD and Powershell. An operating system has a kernel and a shell and CMD and Powershell are shell programs, i.e. programs to interact with the shell. These programs have their own similar but different language (the commands are not all the same). Both CMD and Powershell run inside the terminal, which is another program.

There are many text-based shell which are all command-line programs to interact with the shell of the operating system...Natively, Windows does not have the bash shell (which is instead available in Mac or Linux). However, it seem possible to have access to the bash shell if we either install WSL (Windows Subsystem Linux) or download Git, which automatically come with the Git bash....

My understanding is that Git bash allow us to use the bash shell in Windows, correct? Doe the Git bash run inside the same terminal as CMD and Powershell? I would think so...

How does the Git bash compare with WSL which also make the bash shell available to Windows user? WSL is not a Linux virtual machine but it apparently allows programs that are meant for Linux to run in Windows (same as Wine which Windows programs to run in Linux)?
For example, Docker expects Linux so to run Docker in Windows we need to install WSL...Or is it WSL2 (which is a actual Linux virtual machine) which is different from WSL1? Not sure what WSL1 really is if it is not an Linux emulator.

Thank you!
 
Technology news on Phys.org
On all the installations of GIT bash I have used, it is a stand-alone program. When you run it, it opens a dedicated terminal window into which you can type commends and see console output. It does not use either CMD or Powershell.

The GIT bash shell allows you to use most (not all) Unix Bash commands.

I have not used WSL but from your description it sounds like it does much more than GIT bash. I have not heard of people using GIT bash to run programs designed for Linux on a Windows machine.

Here is a picture of my GIT bash terminal window

1707451758687.png
 

Attachments

  • 1707451588910.png
    1707451588910.png
    26.5 KB · Views: 117
  • Like
Likes   Reactions: fog37 and FactChecker

Similar threads

Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
13
Views
4K
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 20 ·
Replies
20
Views
4K
  • · Replies 12 ·
Replies
12
Views
4K
Replies
16
Views
3K
  • · Replies 12 ·
Replies
12
Views
5K
  • · Replies 16 ·
Replies
16
Views
3K