TExcelTAD
Home › Linux & Bash › Bash Intro

Bash Intro

Linux is the operating system that runs most of the world's servers, cloud machines, containers, Android phones and many developer laptops. Bash (the Bourne Again SHell) is the program that reads the commands you type in a Linux terminal and runs them. Learning Bash means learning to talk to a computer directly: listing and moving files, searching logs, chaining small tools together and automating repetitive work with scripts.

Why learn the command line?

Reason Example
Servers have no desktop You manage a cloud machine over ssh, with only a shell
Automation A 10-line script renames 5,000 photos or backs up a folder every night
Composable tools grep, sort and uniq combine into a log analyser in one line
DevOps Dockerfiles, CI pipelines and Kubernetes jobs are full of shell commands
Speed Many tasks take one command instead of dozens of clicks

Your first commands

A command is a program name, optionally followed by arguments. echo prints its arguments, whoami prints your user name and pwd prints the directory you are in:

bash · try it yourself
echo "Hello from Bash!"
whoami
pwd
Hello from Bash!
learner
/home/learner

Every example in this course runs on a real Linux machine as the user learner, starting in the empty home directory /home/learner. The examples you see are short scripts: Bash reads them line by line, exactly as if you had typed each line at the prompt.

The prompt

In an interactive terminal Bash shows a prompt before each command, usually something like:

text
learner@tad:~$ echo hi
hi
learner@tad:~$

It tells you the user (learner), the machine's host name (tad), the current directory (~ is short for your home directory) and $ for a normal user (# for the administrator, root). In this course the prompt is left out of runnable examples; when a session is shown with prompts, don't type the $.

Commands, options and arguments

Most commands follow the same pattern:

text
command  -options  arguments
   ls       -a        /etc

Options (also called flags) change how a command behaves. Short options are a dash and one letter (-a), and several can be combined (-la is -l -a). Long options use two dashes (--all). Arguments are what the command works on: file names, text, numbers.

bash · try it yourself
echo one two three
printf '%s\n' apples pears
date -d 2026-03-01 +%A
expr 6 \* 7
one two three
apples
pears
Sunday
42

date -d formats a fixed date here; plain date would print the current time, which changes every run.

Getting help

You never have to memorise every flag. Three ways to find out what a command can do:

Command What it shows
man ls The full manual page (press q to quit)
ls --help A short summary of options (most GNU tools)
help cd Help for Bash built-ins such as cd, echo, read
type ls Whether a name is a built-in, an alias or a program on disk
bash · try it yourself
type cd
type echo
help pwd | head -n 3
cd is a shell builtin
echo is a shell builtin
pwd: pwd [-LP]
    Print the name of the current working directory.
    

Built-ins are part of Bash itself; other commands are separate programs stored in directories such as /usr/bin.

Shells and terminals

The terminal (GNOME Terminal, Windows Terminal, iTerm2, the VS Code panel) is the window that shows text. The shell is the program running inside it. Bash is the default shell on most Linux distributions; macOS now defaults to zsh, which is very similar for everyday use. Windows users can get a real Bash through WSL (Windows Subsystem for Linux) or Git Bash.

Tip: Press Tab to auto-complete commands and file names, ↑ to recall earlier commands and Ctrl+C to stop a running command. These three keys save more time than anything else.

What you'll learn

  1. Basics: syntax, scripts, and the everyday file commands (ls, cd, cp, mv, rm, grep, find, tar …).
  2. Text processing: sed, awk, cut, sort, uniq, tr, xargs and friends.
  3. Scripting: variables, quoting, arrays, conditions, loops, functions, arguments and robust error handling.
  4. The Linux system: permissions, users, processes, the filesystem layout, packages, scheduled jobs and shell configuration.

Test yourself

What is Bash?

  1. A text editor
  2. A shell: a program that reads and runs commands
  3. A Linux distribution
  4. A terminal window

In ls -a /etc, what is -a?

  1. An argument
  2. An option (flag)
  3. The command
  4. A variable

Which command tells you whether cd is a built-in or a program on disk?

  1. man cd
  2. which cd
  3. type cd
  4. help