Most beginner tutorials assume you already know what the terminal is. This one doesn't. By the end you'll be able to navigate your file system, create project folders, run programs, and read error messages — all without touching your mouse.
What is the terminal, and why do developers use it?

The terminal is a text-based interface to your computer. Instead of clicking icons and menus you type instructions and press Enter. The computer executes them immediately.
That sounds slower than clicking, but it isn't once you know the commands. A developer can:
- Create 10 nested folders in one command instead of clicking "New Folder" 10 times
- Install a library in 3 seconds with
npm installinstead of hunting through a GUI installer - Run the same sequence of steps every time with no mouse errors
- Connect to a remote server that has no screen at all
Everything in modern development — installing Node.js, running Git, starting a Next.js app — happens through the terminal. There is no way around it.
How to open the terminal
macOS
Option 1 — Spotlight (fastest):
- Press
Cmd + Space - Type
Terminal - Press
Enter
Option 2 — Finder:
Go to Applications → Utilities → Terminal
You'll see a window with a prompt that looks something like this:
yash@MacBook-Pro ~ %
That % (or $ on older Macs) means the terminal is ready for a command.
Windows
Windows has three options. Here's what each one is:
| Tool | What it is | Recommendation |
|---|---|---|
Command Prompt (cmd.exe) | Legacy shell, ships with Windows | Only use if nothing else available |
| PowerShell | Modern shell, ships with Windows | Good, use if you don't want to install anything |
| Windows Terminal | App from Microsoft Store that hosts PowerShell, cmd, and more in tabs | Recommended |
Install Windows Terminal (free, takes 2 minutes):
- Open the Microsoft Store
- Search for "Windows Terminal"
- Click Install
Once open, Windows Terminal starts PowerShell by default. All commands in this guide will work in PowerShell unless marked otherwise.
The mental model: your terminal always has a location
Before any command makes sense, understand this: the terminal is always "inside" a folder on your computer. That current location is called the working directory. Every command you run acts relative to where you currently are.
Core navigation commands
See where you are — pwd / cd with no arguments
Mac/Linux:
pwd
Output:
/Users/yash/Documents
Windows PowerShell:
Get-Location
Output:
C:\Users\yash\Documents
pwd stands for "print working directory." It answers the question: where am I right now?
List what's in a folder — ls / dir
Mac/Linux:
ls
ls -la # show hidden files and file sizes too
Windows:
dir
ls # PowerShell also accepts ls as an alias for dir
Output (Mac example):
Desktop Documents Downloads Projects
Move into a folder — cd
cd Documents
cd Documents/Projects/my-app # jump multiple levels at once
cd .. # go up one level to the parent folder
cd ../.. # go up two levels
cd ~ # jump to your home folder (Mac/Linux)
cd $HOME # same thing on Windows PowerShell
Create a folder — mkdir
mkdir my-project
mkdir -p my-project/src/components # create nested folders in one go (Mac/Linux)
Windows PowerShell:
mkdir my-project
New-Item -ItemType Directory -Path "my-project\src\components" -Force
Create an empty file — touch / New-Item
Mac/Linux:
touch index.html
touch style.css script.js # create multiple files at once
Windows PowerShell:
New-Item index.html
Use an explicit file type when creating a new empty file:
New-Item -ItemType File -Path index.html
Delete a file or folder — rm / del
Mac/Linux:
rm old-file.txt
rm -r old-folder # -r means recursive, needed to delete a folder
Windows PowerShell:
Remove-Item old-file.txt
Remove-Item old-folder -Recurse
Warning: rm on Mac/Linux does not move to Trash. The file is gone. Double-check before pressing Enter.
Copy a file — cp / Copy-Item
Mac/Linux:
cp source.txt destination.txt
cp -r source-folder/ destination-folder/ # copy a whole folder
Windows:
Copy-Item source.txt destination.txt
Copy-Item source-folder -Destination destination-folder -Recurse
Move or rename a file — mv / Move-Item
Mac/Linux:
mv old-name.txt new-name.txt # rename
mv file.txt Documents/ # move to a different folder
Windows:
Move-Item old-name.txt new-name.txt
Move-Item file.txt Documents\
Clear the screen — clear / cls
Mac/Linux:
clear
Windows:
cls
Or press Ctrl + L on both platforms.
Two time-saving shortcuts
Tab completion
Start typing a folder or file name and press Tab. The terminal auto-completes it.
cd Doc[TAB] # completes to: cd Documents
If there are multiple matches, press Tab twice to see them all. Use tab completion constantly — it prevents typos in paths.
Command history
Press the Up arrow key to scroll through previous commands. Press it repeatedly to go further back. Press Down to come forward. When you find the command you want, press Enter.
Running a script or program
Once you've installed a programming language or tool, you run it from the terminal.
Run a Python script:
python3 my_script.py
Run a Node.js file:
node app.js
Run a shell script:
bash setup.sh
The pattern is always: program filename. The terminal finds the program, hands it the file, and shows the output.
Reading error messages
Error messages look scary but they always tell you exactly what's wrong.
| Error | What it means | Fix |
|---|---|---|
command not found: node | The program isn't installed, or the terminal can't find it | Install the program; restart the terminal |
No such file or directory | The path you typed doesn't exist | Check spelling; run ls to see what's actually there |
Permission denied | You don't have rights to run or edit this file | Check the file location, ownership, and required operation before changing permissions |
Is a directory | You used a file command on a folder | Add the -r flag, or switch to the folder-appropriate command |
ENOENT | Node.js version of "No such file or directory" | Same fix — check your path |
When you see an error, read the last line first. It's usually the clearest statement of what went wrong.
Shell, terminal, bash, zsh, PowerShell — what's the difference?
These words get mixed up constantly. Here's the short version:
| Term | What it is |
|---|---|
| Terminal | The app/window where you type (Terminal.app on Mac, Windows Terminal on Windows) |
| Shell | The program running inside the terminal that interprets your commands |
| bash | A shell. Was macOS default until 2019. Still default on most Linux servers |
| zsh | A shell. macOS default since Catalina (2019). Mostly the same as bash for everyday use |
| PowerShell | Microsoft's modern shell for Windows. Different syntax from bash/zsh |
| cmd.exe | Windows legacy shell. Avoid it for new work |
The terminal is the window. The shell is the engine inside it.
Hands-on exercise: build a project folder structure
Do this now. Open your terminal and run these commands exactly. By the end you'll have a real folder structure and you'll have used every command in this guide.
# 1. Go to your home folder
cd ~
# 2. Create a projects folder if you don't have one
mkdir projects
# 3. Enter it
cd projects
# 4. Create a new project folder
mkdir my-first-site
# 5. Enter the project
cd my-first-site
# 6. Create the folder structure
mkdir src
mkdir src/css
mkdir src/js
mkdir public
# 7. Create the main files
touch index.html
touch src/css/style.css
touch src/js/app.js
# 8. Confirm it all exists
ls -R
Expected output:
index.html public src
./public:
./src:
css js
./src/css:
style.css
./src/js:
app.js
Now rename the project:
cd .. # go up to projects/
mv my-first-site portfolio-site # rename the folder
cd portfolio-site # go back in
ls # confirm everything is still there
You just built and renamed a project using nothing but the terminal.
Mac vs Windows command reference
| Task | Mac / Linux | Windows PowerShell |
|---|---|---|
| Where am I? | pwd | Get-Location |
| List files | ls or ls -la | dir or ls |
| Change folder | cd foldername | cd foldername |
| Go up one level | cd .. | cd .. |
| Create folder | mkdir name | mkdir name |
| Create file | touch file.txt | New-Item file.txt |
| Delete file | rm file.txt | Remove-Item file.txt |
| Delete folder | rm -r folder | Remove-Item folder -Recurse |
| Copy file | cp a.txt b.txt | Copy-Item a.txt b.txt |
| Move/rename | mv old new | Move-Item old new |
| Clear screen | clear or Ctrl+L | cls or Ctrl+L |
Inspect permissions before adding privilege
A permission error tells you an operation was refused; it does not automatically mean the command needs administrator access. Check whether you are in the expected folder and whether the operation should touch that file at all. A copied installation command aimed at a system folder differs from editing your own project file.
If a tutorial appears to require elevated access, read the tool's installation instructions and understand what changes. Adding privilege can make an incorrect path more consequential while leaving the original misunderstanding unresolved. For ordinary practice, work in a disposable folder you own and keep the exercise away from system directories.
Quote paths that contain spaces
A path is an argument to the command, and spaces often separate arguments. A folder named “First Project” therefore needs quoting when you pass the whole name. Without quotes, the shell may treat the two words separately and report a confusing error.
cd "First Project"
Use tab completion or quotes rather than renaming every folder to avoid spaces. When copying a command from a guide, replace example paths with your own and preserve the quoting. If a path still fails, list the parent folder and check the actual spelling instead of repeatedly editing the command at random.
Know which shell the example expects
Windows Terminal is an application that can host different shells. Opening a new tab does not guarantee that it is PowerShell. Check the tab profile before copying examples. A command valid in Command Prompt may behave differently in PowerShell even though both appear inside the same terminal window.
In PowerShell, use Get-Location to inspect the current directory; Microsoft's Get-Location documentation explains the command. In a Unix-style shell, use the print-working-directory command shown above. Learning the full command name helps you understand aliases when two shells use a familiar shorthand differently.
Understand a long-running command
A development server keeps running so it can serve requests. If the prompt does not return, that can be expected behavior. Open another tab for additional commands, or stop the server deliberately when you are finished. Repeatedly launching the server can instead create several processes competing for the same port.
Read startup output for the actual address and any error. A displayed command is an instruction; output below it is a result. Copy only the instruction from a tutorial. Including the prompt symbol, an expected response, or a line number can turn an otherwise correct command into an invalid one.
Practice a small recovery
Create a disposable practice folder, enter it, and deliberately try to open a nonexistent child folder. Read the error, list the current contents, then create the missing folder and try again. You have resolved the problem by checking location and evidence rather than adding permissions or reinstalling tools.
Next create a filename containing spaces and rename it using quotes. List the directory after each operation. This simple exercise builds a useful habit: verify a filesystem change with a read before relying on it in the next command. That habit scales from your first project folder to deployment troubleshooting.
What to learn next
The terminal is the foundation. Once you're comfortable here, everything else builds on top:
- Git — version control you run entirely from the terminal. See the Git beginner guide.
- Node.js — JavaScript on your computer, installed and run through the terminal. See the Node.js beginner guide.
- Next.js — React framework you create and run with terminal commands. See the Next.js beginner guide.
- Python — same pattern: install it, run scripts with
python3 filename.py. See the Python beginner guide.
The terminal feels awkward for about a week. After that it feels faster than any GUI you've ever used — a good sign of how far that goes: some developers now run a full VS Code-compatible editor entirely inside the terminal, no separate app window at all.
