Vibe coding with AI course Β· Module 1: Cursor AI - First Steps

Terminal in Cursor

5 min read Β·
In this lesson11

Welcome back! Today you'll learn how to use the terminal - a text-based console for communicating with your computer.

What is the Terminal?

The terminal (command line, console) is a text-based interface for communicating with your computer. Instead of clicking icons, you type commands.

Why is the terminal important?

  • Faster than GUI (graphical interface)
  • More powerful - more possibilities
  • Automation - scripts and tools
  • Essential for working with Next.js, npm, git

Opening the Terminal in Cursor

Method 1: Keyboard shortcut

  • Press Cmd+** (Mac) or **Ctrl+ (Windows/Linux)
  • The ` character is a backtick, located under the ESC key

Method 2: Menu

  • Click Terminal β†’ New Terminal in the top menu

The terminal will open at the bottom of the Cursor screen!

Basic Commands - Must Know

1. pwd - Show where you are

pwd

Output: /Users/user/projects

This shows: "You are in the projects folder"

2. ls - List files

Mac/Linux:

ls

Windows (Git Bash):

ls

Windows (PowerShell):

dir

Output:

pirate.html
ship.js
treasure.css

3. cd - Change directory

cd folder_name

Example:

cd projects

Going up one folder:

cd ..

4. mkdir - Create a folder

mkdir new_folder

Example:

mkdir my_ship

5. touch - Create a file

Mac/Linux:

touch file.html

Windows (PowerShell):

New-Item file.html

Example:

touch index.html

6. clear - Clear the terminal

clear

Or shortcut: Ctrl+L

Practical Example - Creating a Project

Let's create a "Pirate Ship" project using only the terminal:

# 1. Check where you are
pwd

# 2. Create project folder
mkdir pirate_ship

# 3. Enter the folder
cd pirate_ship

# 4. Create HTML file
touch index.html

# 5. Create CSS file
touch style.css

# 6. Check what you created
ls

Output:

index.html
style.css

Congratulations! You just created a project using the terminal!

Node.js and npm - You Need to Know This

When we build Next.js applications, you'll use these commands:

node - Running JavaScript

node --version

Output: v20.10.0 (or another version)

Checks whether you have Node.js installed

npm - Node Package Manager

npm --version

Output: 10.2.3 (or another version)

npm is a package manager - it lets you install libraries and tools

Most important npm commands:

  1. Installing packages:
npm install
  1. Running a project:
npm run dev
  1. Building a project:
npm run build

You'll learn more about this in the next module!

Git - Basics

Git is a version control system - like a diary of changes in your code.

Checking status:

git status

Adding files:

git add .

Commit (saving changes):

git commit -m "Added pirate page"

Push (sending to server):

git push

You'll learn Git in more detail later. For now, just know that it's a tool for saving the history of changes.

Terminal Keyboard Shortcuts ⌨

ShortcutWhat it does
↑ (up arrow)Previous command
↓ (down arrow)Next command
TabAutocomplete file/folder names
Ctrl+CStop a running command
Ctrl+LClear terminal (like clear)
Ctrl+AJump to beginning of line
Ctrl+EJump to end of line

Pro Tips

1. Autocomplete (Tab)

Instead of typing:

cd pirate_ship_with_red_flag

Type:

cd pir[Tab]

The terminal will autocomplete automatically!

2. Command History (↑)

Instead of typing the same command again, press ↑ a few times to find a previous command.

3. Copy-Paste

  • Mac: Cmd+C (copy), Cmd+V (paste)
  • Windows: Ctrl+Shift+C (copy), Ctrl+Shift+V (paste) in terminal

4. Multiple terminals

You can have multiple terminals open at once:

  • Click "+" in the top right corner of the terminal panel
  • Or use Cmd/Ctrl + Shift + `

Common Errors and Solutions

Error: "command not found"

Problem: The command doesn't exist or isn't installed

Solution:

  • Check spelling
  • Install the tool (e.g., Node.js for node)

Error: "permission denied"

Problem: Insufficient permissions

Solution:

  • Mac/Linux: Add sudo before the command (but be careful!)
  • Windows: Run the terminal as administrator

Terminal "froze"

Problem: A command is running and you can't type anything new

Solution:

  • Press Ctrl+C to interrupt
  • Or close the terminal and open a new one

Hands-on Exercise

Run these commands in the Cursor terminal:

# 1. Check Node.js version
node --version

# 2. Check npm version
npm --version

# 3. Check where you are
pwd

# 4. Create a "my_adventures" folder
mkdir my_adventures

# 5. Enter the folder
cd my_adventures

# 6. Create a "journal.html" file
touch journal.html

# 7. See what you created
ls

# 8. Go back up one folder
cd ..

# 9. Clear the terminal
clear

If everything worked - you're ready!

Summary

Terminal is a text-based interface to your computer pwd - where you are ls/dir - what's in the folder cd - change directory mkdir - new folder touch - new file clear - clear screen ↑ - previous command Tab - autocomplete

The terminal may look intimidating, but it's incredibly powerful. Over time it will become your best tool!

In the next modules you'll use the terminal to:

  • Create Next.js projects
  • Install libraries
  • Run applications
  • Deploy to Vercel

You're getting closer to becoming a real pirate-programmer!

Captain Redbeard out.

Code for this lesson: index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Pirate Terminal</title>
    <style>
        body {
            background-color: #000;
            color: #0f0;
            font-family: 'Courier New', monospace;
            padding: 20px;
        }
        .terminal {
            background-color: #1a1a1a;
            border: 2px solid #0f0;
            padding: 15px;
            border-radius: 5px;
        }
        .command {
            color: #00ff00;
            margin: 10px 0;
        }
        .output {
            color: #ffffff;
            margin-left: 20px;
        }
    </style>
</head>
<body>
    <h1>Captain Redbeard's Terminal</h1>

    <div class="terminal">
        <div class="command">$ pwd</div>
        <div class="output">/home/captain/ship</div>

        <div class="command">$ ls</div>
        <div class="output">treasure_map.txt  journal.log  compass.json</div>

        <div class="command">$ cat treasure_map.txt</div>
        <div class="output">Treasure buried on island X: 100 steps north of the palm tree!</div>
    </div>

    <p>This is what a real terminal looks like!</p>
</body>
</html>

Spotted a mistake in this lesson?

Check yourself

Answer the questions from this lesson. Pick an answer to see right away whether it is correct.

  1. 1. What does the pwd command do in the terminal?

  2. 2. What does the ls command do in the terminal?

  3. 3. Which command creates a new folder?

  4. 4. What does the cd .. command do in the terminal?

  5. 5. Which command creates a new file on Mac/Linux?

  6. 6. What is the Tab key used for in the terminal?

  7. 7. What does the up arrow (↑) do in the terminal?

  8. 8. What does the clear command do in the terminal?

  9. 9. What is npm?

  10. 10. Which command installs the project packages?

  11. 11. What is Git?

  12. 12. What does the git status command do?

  13. 13. Which shortcut interrupts a running command in the terminal?

  14. 14. What does the 'command not found' error mean in the terminal?

  15. 15. What does the git push command do?

  16. 16. Which command builds the project to the production version?

  17. 17. Which command adds all changed files to Git?

Hands-on tasks in the game

  • Code editor

    Run the terminal commands and type them in the commands.sh file

  • Click in order

    Click the elements in order to build the command that commits changes with a description:

  • Vertical ordering

    Arrange the commands for creating a project in the terminal (one under another):

  • Horizontal ordering

    Assemble the command that, after typing the prefix, you complete with the Tab key:

  • Click in order

    Click the elements in order to build the command that checks the Node.js version:

  • Horizontal ordering

    Assemble the command that checks the Node.js version (on one line):

  • Click in order

    Click the elements in order to build the command that runs the project in development mode:

  • Horizontal ordering

    Assemble the command that runs the project in development mode:

  • Vertical ordering

    Arrange the Git commands that save and send changes (one under another):

  • Click in order

    Click the elements in order to build the command that adds all files to Git:

  • Horizontal ordering

    Assemble the command that saves changes with a description (on one line):

  • Click in order

    Click the elements in order to build the command that builds the project to the production version:

  • Vertical ordering

    Arrange the commands that check the environment and create a folder (one under another):

  • Click in order

    Click the elements in order to build the command that commits changes with the description 'fixed a bug':

  • Horizontal ordering

    Assemble the command that checks the npm version (on one line):

  • Click in order

    Click the elements in order to build the command that checks the npm version:

  • Vertical ordering

    Arrange the stages of working on a project from start to finish:

Useful articles