Bash Tutorial menu

Bash Tutorial

Bash is the language of the Linux and macOS terminal. You type Bash commands to work with files, run programs and manage servers, and you can save those commands in a script to automate boring jobs.

Almost every web server in the world runs Linux, so Bash is a key skill for developers, system administrators and anyone working in the cloud.

Why Learn Bash?

  • It lets you control a computer with text commands, fast
  • You can automate tasks like backups, renaming files and deployments
  • It is used on servers, in Docker, in CI pipelines and on Raspberry Pi
  • It is already installed on Linux and macOS, and easy to get on Windows

What You Will Learn

  • Opening a terminal and writing your first script
  • Moving around folders and working with files
  • Redirection, pipes and text tools such as grep and sort
  • Variables, input, quoting and arithmetic
  • Conditions with if and case
  • for, while and until loops
  • Functions and script arguments

A First Example

Example

bash
#!/bin/bash
name="Ayesha"
echo "Hello, $name! Today is a good day to learn Bash."
Output
Hello, Ayesha! Today is a good day to learn Bash.

On Windows, install WSL (Windows Subsystem for Linux) or Git Bash to follow along.

Exercises and Quiz

Each lesson ends with a short exercise, and the last lesson is a quiz on everything.

Exercise

What does a Bash script mainly contain?

What to Learn After Bash

With Bash you can manage servers and automate work. Next, try Go or Rust to build your own command-line tools, or Python for bigger automation scripts.

Want to learn programming and automation with a teacher? The Workownix Python Programming course builds on these skills, online or at our institute in Orangi Town, Karachi.

Learn Bash with a teacher

Join the Python Programming course at Workownix, online or in Orangi Town, Karachi, and get a certificate.

See the course Ask on WhatsApp