Skip to content
Programming contents

Lesson 2.2: The terminal

The terminal is another way to use your computer: instead of clicking, you type commands.

The idea

In the terminal you type an order, press Enter and the computer does it. Each order is called a command.

It's faster than the mouse for many things, and almost every programming tool is used from here.

Opening it

  • Windows: search for "Terminal" in the Start menu.
  • macOS: Cmd + Space, type "Terminal" and press Enter.
  • Linux: Ctrl + Alt + T.

The terminal is always in a folder. When it opens, it's your home folder.

Five commands

CommandWhat it does
pwdSays which folder you're in
lsLists what's in it
cd folderGoes into a folder
cd ..Goes up to the folder above
mkdir nameCreates a folder

They work on all three: on Windows, the terminal uses PowerShell, which understands them too.

A walk

Terminal
pwd
Terminal
/Users/ana
Terminal
mkdir projects
cd projects
pwd
Terminal
/Users/ana/projects

On Windows you'll see C:\Users\ana and the output looks different, but it says the same.

Two tricks

  • Tab completes the name: type cd proj and press Tab.
  • Up arrow brings back the previous command.

Try it

Exercise

From your home folder, create projects/my-game and go into it. Check with pwd that you're where you should be.

Show the solution
Terminal
cd ~
mkdir projects
cd projects
mkdir my-game
cd my-game
pwd
Terminal
/Users/ana/projects/my-game

~ is your home folder. If projects already existed, mkdir complains with an error and nothing breaks: carry on with cd projects.

Summary

  • The terminal runs typed commands.
  • It's always in a folder: pwd says which.
  • ls lists, cd goes in and out, mkdir creates.
  • Tab completes; the up arrow repeats.