The CLI (Command-line interface) is a developer's friend and power tool. Learn some of the most important commands and see how the CLI can supercharge your workday.
You'll learn some basic bash programming and produce a simple deployment script for a remote location.
This repository contains a link to a Google Presentation with a quick introduction to the CLI, some tips on useful tools and exercises. Happy hacking!
Slides from the workshop presentation 2026-02-10
You'll only need the Bash shell:
- Linux: Bash is already included
- MacOS: zch is now the default shell in the terminal and version 3.2 of bash is included. If you are familiar with homebrew, you can update bash, but we believe that all tasks can also be solved with zsh or bash 3.2.
- Windows: Install Git for Windows - Remember to opt in for Git Bash when installing
- Start by cloning this repository into a folder on your computer. If you've never used git before, you can alternatively use the the green "Code" button to the top right, and then select "Download zip". Unzip the downloaded zip file (make sure to remember where you put it).
- Although you have this
README.mdfile on your computer, it's easier to read it on GitHub with formatting. We therefore recommend you keep a web browser tab open with the exercise tasks. - Start by opening exercise 1.
- Remember to ask an instructor if you're stuck.
- Exercise 1 - Getting started
- Exercise 2 - Basics of the shell
- Exercise 3 - Scripting
- Exercise 4 - Using pipelines and redirects
- Exercise 5 - Number guessing game
- Exercise 6 - Redirects and grep
- Exercise 7 - Case statements
- Exercise 8 - Menu-driven scripts
- Exercise 9 - String manipulation
- Exercise 10 - Stream editing with sed
- Bonus exercise - Bonus exercise(s)
If you get stuck or need hints, you can find the solutions in the solutions folder.
- ✏️ An exercise you need to complete
- 💡 Extra information or tips. You don't need to do anything, but take the information with you.
- 💩 Bad practice, often an unfortunate way to solve a problem.
- ⭐ A bonus exercise
Tips on keyboard shortcuts look like this: CTRL + ALT + C
A diff-block will show if there is text that should be added or removed (- removed, + added)
- this text was removed
+ and replaced with this textSee command line cheat sheet.
ls: what's in this directory? ("list")pwd: where am I standing in the file system? ("print working directory")cd: take me to indicated directory ("change directory")find: find a file from given directory in the file tree
history: show me the commands I've runtail: read me the last lines of a filehead: read me the first lines of a fileless: non-editable view of a filecat: list contents of a file to standard outgrep: search for a string of characters in a file using given regular expression
mkdir: make a directory ("make dir")cp: copy a file or directory ("copy")mv: move a file or directory ("move")rm: delete a file or directory ("remove")chmod: change file permissions ("change mode")touch: change last-modified timestamp of a file without editing it
echo: print to screen (thinkSystem.out.println)|: send the output (pipe the output) to the next command>and<: redirecting input and output streamsfor- loop through a list of itemsif- conditional statementsvar=value- assign a value to a variable
- Ask the instructors
- Ask an AI-assistant like ChatGPT. For example "How do I list all .txt files with bash?". Note: for maximum learning don't ask AI agents to give you answers directly. Instead, say something like "I'm learning Unix command line. Please, give me hints, but not answers." Then ask your question.
- Google is, as always, your friend
- Commands typically have the
-hor--helpflag to show help. For examplels --helpwill show you the help for thelscommand. - See the cheat sheet.
man <command>- run themancommand to get help for a command. For exampleman lswill show you the help for thelscommand.