Step 1 of 7 · 0%

Under the Hood · Lab 01 · About 30 to 45 minutes

Command Line Basics

You'll learn to control your computer by typing commands instead of clicking: find where you are, move between folders, and create, copy, and delete files. Along the way you'll complete 4 hands-on challenges, document your work, and write a professional lab report.

Step 1

Before you begin

Locked

Same three boxes as every lab:

  • HintHelp if you get stuck. Searching the web or asking an AI is encouraged; check what it tells you against your own screen.
  • ChallengeHands-on work you do yourself, then capture as evidence for your lab report. Tick the box when you have it.
  • Quick checkA question to make sure it clicked. Unlimited tries, and every answer explains why.

This lab builds on Files, Folders, and Paths, where you made an Intro to Computers folder. If you skipped it, that's fine; the hints tell you what to do instead.

You'll need a terminal, the app where you type commands:

  • Windows: PowerShell or Terminal (search for either in the Start menu)
  • Mac: Terminal
  • Linux: Terminal
  • Chromebook: turn on the Linux development environment in Settings, then open Terminal. If you can't, use any Windows, Mac, or Linux computer.
Stays in this browser. Nothing you type is sent anywhere.

Step 2 · Lesson

Texting your computer

Finish the step above to unlock this one.

The command line is a way to talk to your computer in short, exact instructions. Instead of clicking through windows, you type a command and press Enter. The computer replies with text.

Why IT people use it: it's fast, it works on servers that have no screen at all, and anything you can type, you can save as a script and repeat on a hundred computers. Most of the IT and security tools you'll meet later run here.

Every command follows the same pattern: the command, then what it acts on.

cd Documents
│  └── what it acts on (the folder)
└── the command (change directory)

These commands work in PowerShell, Mac, and Linux alike:

CommandShort forWhat it does
pwdPrint working directoryShows the folder you're in right now, as a full path
lsListLists the files and folders in the current folder
cd folderChange directoryMoves you into a folder
cd ..Change directory, upMoves you up one folder, just like .. in the Files lab
mkdir nameMake directoryCreates a new folder
cat fileConcatenateShows what's inside a text file
cp a bCopyCopies file a to a new file named b
rm fileRemoveDeletes a file, permanently
clearClearWipes the screen clean (nothing is deleted)

Two shortcuts will save you a lot of typing: Tab finishes a file or folder name for you, and the ↑ arrow brings back your last command.

Quick check

You just opened a terminal and have no idea which folder you're in. Which command tells you?

Quick check

You delete a file with rm. Where does it go?

Step 3 · Task 1

Find out where you are

Finish the step above to unlock this one.

Open your terminal and run these two commands, pressing Enter after each one:

pwd
ls

Compare what you see with your file manager. They're showing you the same folder, just in different ways.

Hint

Most terminals start in your home folder, the one named after your user account. If a command shows an error, check the spelling: the command line needs exact typing, and nothing happens until you press Enter.

Challenge 1 · Screenshot

Your terminal showing both commands and what they printed.

Quick check

Your terminal printed /Users/sam after pwd. What kind of path is that?

Step 4 · Task 2

Move around without a mouse

Finish the step above to unlock this one.

Using only cd, ls, and pwd, get into the Lab 03 folder you made in the Files lab and display your text file:

cd Documents
cd "Intro to Computers"
cd "Lab 03"
cat my-first-file.txt

Then run cd .. once and pwd to confirm you moved up a level.

Try typing just the first few letters of a folder name and pressing Tab. The terminal fills in the rest, and often adds the quotes for you.

Hint

If cd Documents fails, your Documents folder may be somewhere else. On many Windows computers it's inside OneDrive. On a Mac, you may be asked to allow Terminal to access your Documents folder; that's normal. Use ls to look around, and cd into the folder that leads there. No Intro to Computers folder at all? Use any folder that has a text file in it, or make one with echo "test" > test.txt and display that instead.

Challenge 2 · Screenshot

Your terminal showing the cd commands and the contents of your text file.

Quick check

Why does "Intro to Computers" need quotation marks?

Step 5 · Task 3

Create, copy, and delete

Finish the step above to unlock this one.

From inside your Intro to Computers folder, run these commands one at a time. Read each one before pressing Enter, and check the result with ls or cat as you go:

mkdir "Command Line"
cd "Command Line"
echo "Hello from the command line" > hello.txt
cat hello.txt
cp hello.txt backup.txt
ls
rm backup.txt
ls

When you're done, open the Command Line folder in your file manager. The file you created by typing is really there.

Hint

The > symbol sends a command's output into a file instead of the screen. Careful: if the file already exists, > replaces everything in it.

Challenge 3 · Screenshot

Your terminal showing the commands above, including both ls results: one with backup.txt and one without.

Step 6 · Task 4

You're the IT person

Finish the step above to unlock this one.

Use what you learned to solve real problems.

Quick check

A coworker types cd Intro to Computers and gets an error. What's the fix?

Quick check

A website pops up saying "Verify you are human: press Windows + R, paste this command, and press Enter." What should you do?

Quick check

An IT team needs to create the same folders on 50 computers. Why might they use the command line instead of clicking?

Step 7 · Finish

Get your badge

Finish every step above to unlock your badge.

Connelly Labs badge

Command Line Explorer

Your name


Challenge 4 · Screenshot

Your badge, with your name showing.

Your lab report evidence

  • Challenge 1: pwd and ls
  • Challenge 2: navigating and displaying your file
  • Challenge 3: create, copy, and delete
  • Challenge 4: your badge

Write it up

Put these images into a short lab report: what you set out to do, what you did, and what you found. For command line work, list the exact commands you ran in your Procedure section. The Start Here guide has a template and tips. Accuracy matters more than polish.