The shell is not just a black screen where you type commands. It is a programmable environment that, used well, saves you hours. This block teaches you to use Bash beyond the basic commands: variables, expansions, customisation and a first script.
Why this block exists
Many beginners know ls and cd but get stuck as soon as they need to combine commands, use a variable or automate a repetitive task. This block bridges the gap between "I can type a command" and "I am productive in the terminal".
It covers four steps:
- understand Bash as a shell and as a language;
- handle environment variables and expansions;
- customise your terminal to work in comfort;
- write a first script to automate a sequence of commands.
The recommended path
The guides below go from using the shell to programming it: first the interactive moves, then the mechanisms that make a command line shorter, and finally the script that replays it for you.
1. Know your shell
Getting started with Bash explains what Bash is, its role as the interpreter between you and the system, and what sets it apart from the other shells you will meet on a server.
2. Master variables and expansions
Environment variables such as PATH, HOME and USER configure your session: knowing how to read and change them explains why a command is not found in one context and not in another. Shell expansions, from globbing to braces and command substitution, let the shell write part of the line for you.
3. Make the terminal comfortable
Customise your shell covers aliases, the prompt and configuration files such as ~/.bashrc, for a terminal that tells you where you are and shortens long commands.
4. Automate
The guide to write a first script goes from creating the file to running it: shebang, execute permission and the first run of a Bash script that replays a sequence of commands.
Key points
- Bash is both a command interpreter and a scripting language: learning its mechanisms multiplies your efficiency.
- Environment variables (
PATH,HOME) configure the behaviour of your session and your programs. - Expansions (
*,{},$()) save you from typing repetitive code: the shell does it for you. - An alias or a function in
~/.bashrcreplaces a long command with a short word. - The first script is the entry point to automation: anything repetitive can be scripted.