The terminal, step by step
You'll learn to move around folders and make new ones by typing commands in the terminal.
Watch & read
Start with the required ones. The others are there when you need them.
Explanation
You already move between folders by clicking. The terminal lets you do the same by typing short commands. It feels slow at first. Soon it is faster than clicking, and many developer tools only work here.
Think of it as talking to the computer through SMS instead of tapping buttons. You type one line, press Enter, and it replies. At every moment you are standing inside one folder, called the working directory. Every command works from there.
Five commands do most of the work:
pwd where am I?ls what is in this folder?cd projects go into the projects foldercd .. go up one foldermkdir notes make a new folder called notestouch todo.txt make a new empty file
cd with no folder name takes you home. ~ is a short name for your home folder, so cd ~/projects
works from anywhere.
On Windows, install Git for Windows and use Git Bash. Then every command on this page works the
same. In PowerShell, pwd, ls, cd and mkdir also work, but touch does not: use
New-Item todo.txt instead. The old Command Prompt uses dir instead of ls.
People often type cd notes while standing in the wrong folder. The terminal replies
cd: no such file or directory: notes. It is not broken. It is telling you there is no folder called
notes here. Run pwd and ls to see where you are and what is really there. Also check the
spelling. On Linux and on most servers, capital letters matter too: Notes and notes are different.
When you read terminal commands in a tutorial, read them as "command, then what it acts on":
mkdir notes is "make folder, called notes". Run pwd whenever you feel lost. It never changes anything.
Code tour
Click a line number with a ring to read the note for that line.
Quick check
3 questions. Each one explains itself after you answer.
- 1 / 3You are not sure which folder you are in. Which command tells you?
- 2 / 3You run
cd projectsand seeno such file or directory: projects. What should you do first? - 3 / 3You are in
/Users/rafi/projects/notes. Aftercd .., where are you?