← Other topics

Simplest command line program for Windows - Git Bash

Video Notes

If you’re new to programming, working on Windows, and want to get started with command line, I recommend using Git Bash.

Git Bash application running on Windows

The advantage of Git Bash is it uses Unix-based commands which are common across a variety of platforms (Mac, Linux, many web servers, etc.). This is in contrast to commands you’d use in something like PowerShell, which is a Windows-specific command line program. I only recommend focusing on PowerShell if you know your development work is going to be Window’s specific.

Another advantage of Git Bash is it’s lightweight and easy to set up. This is in contrast to something like WSL (Windows Subsystem for Linux), which is another way you could get a Unix-based programming environment on Windows. The setup for WSL is a little more complex and in general has more overhead, so it’s not the path I suggest for beginners.

All the “why Git Bash” behind us, let’s dig into the details...

Download and install

Visit https://gitforwindows.org/ and click the Download button. What you’re downloading is actually a package of software related to Git version control; as part of this package, you’re getting the Git Bash command line program.

When you load the installer, it will take you through a series of screens to configure your install. As shown in the video, As shown in the video, I leave all these options as their defaults except for the following two screens.

  1. For the default editor used by Git I choose my code editor of choice, VSCode, from the dropdown
  2. For the name of the initial branch in new repositories I set it to override to main.
Install screens for Git Bash on Windows

After the installer is complete, you should have access to the Git Bash program that looks like this:

Git Bash application running on Windows

Basic commands

In the video, I highlight the following commands:

  • cd Change directory
  • cd ~/ Change to your home directory using the ~ shortcut
  • cd ../ Move “up” one directory
  • ls List directory contents
  • nano example.txt Create a new text file
  • cat example.txt Show the contents of a text file
  • rm example.txt Remove a file
  • rm -r demo Remove a directory

For more guidance on commands, check out my video Command Line Basics (Terminal / Git Bash) starting at the 6:34 timecode (everything before that talks about getting your command line program set up, which you just did!)

If this info helped you out you can say thanks and support future content by clicking my Amazon affiliate link: https://amzn.to/3UtgnYk. If you make a purchase on Amazon within 24 hours of clicking the link I may receive a micro-commission and it costs you nothing extra. Any income from these sales goes directly to supporting me in making new videos and guides. Thank you for your support!

← Other topics