Terminal and TXT Files: Your First Steps in Coding

Introduction

You're about to write your first code—not JavaScript, not HTML—but something far more practical: terminal commands and plain-text files.

Right now, you just need to know 5 things:

  1. pwd — "Where am I?"
  2. cd — "Move to a folder"
  3. ls — "What's in here?"
  4. code . — "Open this folder in VS Code"
  5. history — "What did I just do?"

That's it. You'll spend some time practicing these five things until they feel like muscle memory. Once they do, every lesson after this one becomes easier because you'll navigate projects like a real developer.

Core Concept: The Terminal is Just Another Way to Navigate

You already know how to navigate your computer using the GUI (the Graphical User Interface—folders, double-clicks, dragging files). The terminal is just a text-based way to do the exact same things.

Compare:

ActionGUITerminal
"Where am I?"Look at the folder windowpwd
"What's in this folder?"See the folder contentsls
"Go into that folder"Double-click itcd foldername
"Go back one level"Click the back arrowcd ..
"Go home"Click Home in the sidebarcd ~
"What did I type?"Look at your browser historyhistory

One is visual. One is text-based. Both do the same job.

The 4 Commands You Need Right Now

Don't use these just yet. First, read through what each does and why it's useful.

1. pwd — Print Working Directory

What it does: Shows you exactly where you are in your computer's folder structure.

pwd

You might see output like:
/Users/yourname/Dev/projects

This means: "I'm in the projects folder, which is inside Dev, which is inside yourname, which is inside Users." It's a path—a map to your current location.

Use case: Anytime you're unsure where you are, type pwd. It's like looking up at a street sign.

2. ls — List

What it does: Shows all the files and folders in your current location.

ls

You might see something like:

Desktop
Documents
Downloads
bio.txt
styles.css

With flags (the 🏴 way):

Flags are little options you add to commands. The most useful flag for ls is -l (lowercase L):

ls -l

This shows more detail about each file (size, date modified, permissions). Try it—you'll see the difference immediately.

Another useful flag: -a shows all files, including hidden ones (files starting with a dot, like .gitignore):

ls -a

You can combine flags:

ls -la

This shows all files with details. Most developers use this a lot.

3. cd — Change Directory

What it does: Moves you into a different folder.

cd Dev

Now you're inside the Dev folder. If you type pwd, you'll see your path has changed.

Special cd tricks:

  • cd ~ — Go to your home folder (where Documents, Downloads, etc. live)
  • cd .. — Go up one level (to the parent folder)
  • cd (just cd alone) — Go to home folder (same as cd ~)
  • cd / — Go to the very root of your computer (rarely needed)

Pro tip: Type cd Dev then press Tab. The terminal will auto-complete. This saves typing and prevents mistakes.

Understanding . and ..

These two tiny symbols show up everywhere and unlock a lot of power:

  • . (dot) means “the current folder I’m standing in.”
    • Examples: code . opens your current folder in VS Code; ls . lists the current folder (same as ls).
  • .. (dot‑dot) means “the parent folder one level up.”
    • Examples: cd .. moves up one folder; ls .. lists the parent folder.

Think of folders like addresses on a street:

  • . is the house you’re in right now
  • .. is the house next door behind you (one step back)

You’ll also see these in path references later (HTML/CSS and imports):

  • ./hello.js — a file inside the current folder
  • ../images/logo.png — a file inside the parent folder’s images subfolder

4. code . — Open in VS Code

What it does: Opens the current folder in Visual Studio Code.

code .

The dot (.) means "the current folder I'm standing in." VS Code will launch and show all the files in that folder.

5. history — See What You've Typed

What it does: Shows a list of all the commands you've run in this terminal session.

history

You'll see a numbered list of every command you've typed. This is handy when you:

  • Want to re-run a command you used 10 steps ago
  • Forgot the exact syntax
  • Want to remember what you did earlier

Keyboard shortcuts (even faster):

  • Press the ↑ arrow key to cycle backwards through recent commands
  • Press the ↓ arrow key to cycle forwards
  • Ctrl + R (Mac/Linux) or Cmd + R (some terminals): Search through history by typing part of a command

Why it matters: The terminal never forgets. Every command you type is there if you need it. This takes the fear out of "what was that command I ran?"

Quick note about PowerShell and other terminals

In this course, we’ll use Warp as our main terminal. Warp gives you a modern experience plus built‑in AI help 🤖, and it uses the same Unix‑style commands that professional developers use every day.

If you're on Windows, you might be used to PowerShell or cmd.exe. You can use PowerShell if you really want to—most of the commands we teach (pwd, ls, cd) will still work because PowerShell provides them as aliases. Just know that some details and options may look a little different than what you see in the lesson.

So: Warp is the recommended default (best match to the lessons + AI superpowers). PowerShell is there if you insist—but that’s at your own small risk. 🙂

Hands-On: Create Your First Project

Open up Warp Terminal.

Note for Windows Users: If you hit permission issues in Warp Terminal, switch to GitBash and re-run the command. Warp is great for AI assistance, but GitBash is our backup.

Step 1: Navigate Home

pwd

See where you are. Now go home:

cd ~

Verify:

pwd

Step 2: Create a Dev Folder

mkdir Dev
cd Dev

Verify you're in the right place:

pwd
ls

Step 3: Create a Practice Folder

mkdir TXTPractice
cd TXTPractice

Verify:

pwd

Step 3.5: Walk back home manually (practice ..)

Now that you’re inside TXTPractice, practice moving “up” without shortcuts:

  1. Check where you are:

    pwd
    

    You should see something like /Users/yourname/Dev/TXTPractice.

  2. Move up one level into Dev:

    cd ..
    pwd
    

    You should now be in /Users/yourname/Dev.

  3. Move up one more level into your home folder:

    cd ..
    pwd
    

    Stop when you see /Users/yourname (your actual name will be there). That’s “home.”

  4. List what’s in your home folder to confirm:

    ls
    

The goal here is muscle memory: when you see .., think “go up one folder.” We’ll use this often for relative paths later.

Step 4: Create a Text File

touch bio.txt

Check it was created:

ls

Step 5: Open in VS Code

code .

VS Code will open showing your folder. You should see bio.txt in the file explorer.

Step 6: Write in Your File

Click bio.txt in VS Code and type a few sentences about yourself. Save it with Cmd + S (Mac) or Ctrl + S (Windows).

Step 7: Verify from Terminal

Go back to your terminal. You're still in the TXTPractice folder. List the files:

ls

You should see bio.txt. You just created a file, opened it in an editor, wrote to it, and verified it from the terminal. This is how developers work.

Step 8: Create a JavaScript File

Now let's try something new: JavaScript. You don't need to understand everything yet—just follow along and run the code. Confusion 😕 is totally okay at this point. 🆗

While you're still in the TXTPractice folder in your terminal, create a new file:

touch hello.js

⚠️ FILE EXTENSIONS MATTER!

Notice the .js at the end of the filename. This is a file extension—it tells your computer what type of file this is.

  • .txt = text file
  • .js = JavaScript file
  • .html = HTML file
  • .css = CSS file

The computer and tools like node look at the extension to know how to handle the file. If you named it hello (no extension), or hello.txt, or hello.jsx, the node command wouldn't recognize it as JavaScript and wouldn't run it the same way.

Think of it like this: If you mail a letter in an envelope labeled "FRAGILE," the postal worker handles it carefully. If you don't label it, they treat it like any other package. Extensions are labels.

Check it was created:

ls

Step 9: Write Some JavaScript

Click on hello.js in VS Code and write:

// This prints text to the console
console.log("Hello JS");

Save the file (Cmd + S or Ctrl + S).

What's happening here?

  • console.log() is a command that prints things
  • Anything inside the parentheses and quotes gets printed
  • We used single quotes ('), but double quotes (") work too

Step 10: Run JavaScript from the Terminal

Go back to your terminal. Make sure you're still in the TXTPractice folder (type pwd to check). Then run:

node hello.js

You should see Hello JS printed in your terminal.

Congratulations! You just ran real code. This is huge. 🎉

Step 11: Use a Variable and Template Literal

Now let's level up a tiny bit. Update hello.js to:

// Store a name in a variable
const name = "Alex";

// Use a template literal to build a message
const message = `Hello, ${name}! Welcome to JavaScript.`;

console.log(message);

Save the file and run it again:

node hello.js

You should see Hello, Alex! Welcome to JavaScript.

What just happened?

  • We created a variable called name and stored a value in it. This uses the computer's memory and lets us reuse that value by assigning it to a name.
  • We used a template literal (those backticks: `) to combine text with the variable. It's a way to build strings that include variables. It's like 'fill in-the-blank' for text.
  • The ${name} part says "put the value of name here," rather than the word "name." This will only work inside template literals (the backticks) and will only work if there is something in memory with that variable name.

If this doesn't make 100% sense yet, that's completely normal. We'll cover variables and template literals in depth soon. For now, just know that you ran real JavaScript code from the terminal. That's the important part.


Key Takeaway

The terminal is just another way to navigate your computer. You've learned the four commands you need right now. Everything else builds on top of these four. Keep practicing until they feel natural. By next week, using pwd, cd, ls, and code . should feel as automatic as using your mouse.