Learn Linux from scratch: terminal and SSH
Almost every server in the world runs Linux, and almost none of them has a screen. There’s no desktop, no windows and no mouse: only a TerminalAn application where you give the computer instructions by typing text instead of clicking. Almost every server is managed this way.Go to definition where you type commands and read responses. In Phase 0 you saw where data travels. In this phase you’ll learn to find your way around the place where backend code lives.
You won’t write any code yet. You’ll learn to use a computer with text alone, which is how you work on a server, and to get into one that’s far away.
What you will learn
Section titled “What you will learn”By the end of this phase you’ll move around the terminal of a Linux server with ease. You’ll know how to:
- Move through folders, read and edit files, and chain commands together.
- Tell what users, permissions, processes and services are.
- Configure programs with environment variables and write small scripts.
- Log in to a remote server over SSH with your own key.
- Use Git from the terminal, knowing what happens inside.
The lessons
Section titled “The lessons”- The shell: commands and paths
- Files and text
- Pipes and redirection
- Users and permissions
- Processes and signals
- Services and packages
- Environment variables
- Shell scripts
- SSH
- Git internals
Where you will practice
Section titled “Where you will practice”Each lesson tells you where its “Try it” happens. There are three places, from smallest to biggest:
| Where | What for | From |
|---|---|---|
| Your terminal | Moving through folders, working with files, chaining commands, processes, variables and scripts | Lesson 1 |
| Your practice server | What only a Linux server has: users, services and installing programs. It’s also where SSH takes you | Lesson 4 |
| Real servers, on the internet | Logging in over SSH to machines that aren’t yours | Lesson 9 |
The practice server is a virtual machine: a computer simulated inside yours, running Ubuntu, the most widely used version of Linux on servers. You’ll create it in lesson 4 with Multipass, a free program from Canonical, the company that makes Ubuntu. Until then you don’t have to install anything.
- On Windows, follow the course with WSL, as explained in the Phase 0 introduction. WSL is already an Ubuntu, so it will also work as your practice server.
- If you can’t install anything (on a work computer, for example), WebVM gives you a Linux inside the browser. It’s enough for the first lessons; for the practice server and SSH you’ll have to install something.
Before you start: your practice folder
Section titled “Before you start: your practice folder”First, check which system is underneath your terminal:
1. Which system do you have?
unameWhat you will see:
Darwinuname prints the name of the system. On a Mac you get Darwin, the core of macOS. On Linux and WSL you get Linux. The servers in this phase will say Linux.
The exercises in this phase create, move and delete files. So that they never touch anything of yours, they always happen inside a practice folder.
They won’t ask you for administrator permissions on your computer either: whatever needs them is done on the practice server. The only exception is installing that server, in lesson 4.
Create the folder now. Copy the three lines, paste them into the terminal and press Enter:
2. Your practice folder
mkdir -p ~/backend-course/phase-1cd ~/backend-course/phase-1pwdWhat you will see:
/Users/ana/backend-course/phase-1mkdircreates a folder (it comes from make directory). With-pit also creates any missing folders along the way, and doesn’t complain if they already exist.cdtakes you to that folder.pwdtells you which folder you’re in.
In lesson 1 you’ll see what each part means, including the ~. Your result will be different: we’ve replaced the username with an example one, ana, and on Linux and WSL the path starts with /home instead of /Users.