Beginner โฑ 10 min Lesson 1 of 13

๐Ÿš€ Introduction to Bash

What is Bash, why learn it, and setting up your environment.

Welcome to Bash!

Bash โ€” short for Bourne Again SHell โ€” is the default command-line interpreter on most Linux distributions and macOS. It was created by Brian Fox in 1989 as a free replacement for the Bourne Shell (sh). Today it remains one of the most widely used shells in the world, powering everything from tiny embedded devices to massive cloud servers.

Why Learn Bash?

  • Automation: Turn repetitive tasks into one-click scripts.
  • Server Management: Almost every server you'll ever touch runs Linux.
  • DevOps & CI/CD: Pipelines, containers, and infrastructure-as-code all rely on shell scripts.
  • Career Growth: Bash proficiency is expected for sysadmins, DevOps engineers, and backend developers.
  • Speed: Many tasks are faster from the command line than from a GUI.

Terminal vs Shell vs Console

These terms are often used interchangeably, but they mean different things:

  • Terminal (Terminal Emulator): The window application that hosts your command line โ€” e.g., GNOME Terminal, iTerm2, Windows Terminal.
  • Shell: The program that interprets your commands โ€” e.g., Bash, Zsh, Fish.
  • Console: Historically, the physical device; today it usually means the same as "terminal."
๐Ÿ’ก Tip: You can check which shell you're running with echo $SHELL or echo $0.

Opening a Terminal

How you open a terminal depends on your operating system:

  • Linux: Press Ctrl + Alt + T or search for "Terminal" in your application launcher.
  • macOS: Open Spotlight (โŒ˜ + Space), type Terminal, and press Enter.
  • Windows: Install WSL (Windows Subsystem for Linux) or use Git Bash.

Your First Command: echo

The echo command prints text to the terminal. Think of it as the Bash equivalent of print or console.log.

bash
echo "Hello, World!"

You can also use single quotes or no quotes for simple strings:

bash
# Double quotes โ€” allows variable expansion
echo "Home is $HOME"

# Single quotes โ€” everything is literal
echo 'Home is $HOME'

# No quotes โ€” works for simple words
echo Hello
โš ๏ธ Warning: Be careful with special characters like !, $, and * when using double quotes โ€” Bash may interpret them.

Try It Yourself

Use the interactive terminal below to practice the echo command. Try printing your name!

Terminal

Summary

In this lesson you learned what Bash is, the difference between a terminal and a shell, how to open a terminal on your OS, and how to use the echo command. In the next lesson, you'll learn how to navigate the file system like a pro.

๐Ÿงช Test Your Knowledge

Answer the questions below to check your understanding of this lesson.