Step 1. First Steps in PowerShell — Driving Your Computer with Text
Level 0 — Understanding How to Operate a Computer and How It’s Structured | Difficulty ★☆☆☆☆ | Estimated time: 2–3 hours
Prerequisites: none. All you need is one Windows computer. This is the true first page of this book.
- What you need: a Windows PC, a keyboard, and a decision not to be intimidated.
- Safety: every exercise today is 100% safe. They’re all read-and-move commands, so there’s no way to break your computer.
- Screen differences: output may differ slightly from this book depending on Windows 10/11, your PowerShell version, and language settings. As long as the essentials match, you’re fine.
- Attitude: it’s okay not to understand everything — but type every command yourself. Just reading will never make it stick. And an error caused by a typo isn’t failure; it’s tuition. Red text on the screen doesn’t break your computer.
Right now, this is how you use a computer: you double-click folder icons, drag files, and click buttons. That’s called a GUI (graphical user interface). But in the world this book teaches — server administration, hacking, security analysis — a GUI is usually absent or useless. Corporate servers have no graphical screen, and what appears when you gain access during a penetration test is a text terminal. So starting today, we learn the CLI (command-line interface) — a way of driving the computer with text. Our first tool is PowerShell, already installed on Windows.
1. Learning Objectives
By the end of this chapter, you can:
- Open PowerShell and read your current location from the prompt
- Use
Get-LocationandGet-ChildItemto answer "where am I, and what’s here" - Move around with
cdusing both relative paths and absolute paths - Handle paths containing spaces correctly with quotes
- Cut down on typing with Tab completion and the ↑ key
Today’s goal in one sentence: without opening File Explorer (the GUI), you can move around inside your computer using only commands and figure out "where am I, and what’s here."
2. Background Knowledge — Today’s Tools and Concepts
Today’s Tools at a Glance
| Category | Details |
|---|---|
| Language/environment | PowerShell — the shell preinstalled on Windows. Nothing to install |
| Today’s commands | Get-Location (=pwd), Get-ChildItem (=ls, dir), cd path |
| Today’s techniques | Tab completion, recalling previous commands with ↑ |
| Concepts you need | CLI vs GUI, terminal and shell, the prompt, the directory tree, absolute vs relative paths, quoting rules |
2-1. Terminals, Shells, and PowerShell
Let’s sort out the terminology first (it’s easy to mix up):
- Terminal: the "window" you type commands into (the dark screen itself)
- Shell: the program inside it that interprets and executes your commands (the translator)
- PowerShell: the name of the shell Microsoft built
A restaurant analogy: the terminal is the "order slip," and the shell is the "kitchen." You write text on the slip (enter a command), and the kitchen reads it and sends out the dish (prints the result). What we’re opening today is "a terminal window with a kitchen called PowerShell attached."
2-2. The Directory Tree — A Map of Your Computer
Files inside a computer are stored in a structure of folders inside folders inside folders. Picture it as an upside-down tree:
C:\ ← the root. The starting point of everything
├── Users\ ← where users live
│ └── Lee\ ← my home (differs by username)
│ ├── Documents\ ← documents
│ ├── Downloads\ ← downloads
│ └── Desktop\ ← desktop
├── Windows\ ← the operating system itself
└── Program Files\ ← installed programs
"Moving" in the CLI means climbing up and down the branches of this tree.
2-3. Absolute and Relative Paths — Two Ways to Write an Address
There are two ways to write the location of a file or folder:
| Type | Meaning | Example |
|---|---|---|
| Absolute path | A complete address written from the root (C:\) |
C:\Users\Lee\Documents |
| Relative path | A shorthand address based on "where you are now" | Documents (when you’re in C:\Users\Lee) |
As a home-address analogy: an absolute path is writing the full address from the country down; a relative path is "two blocks up from here, then turn right" — based on your current position.
Two special symbols used in relative paths:
..: the folder one level up (the parent folder).: the folder you’re in now (rarely used, but good to know)
3. Follow Along — Time to Get Your Hands Moving
3-1. Opening PowerShell
- Press the
Windows keyon your keyboard (the Start menu opens). - With it open, just type
powershell. (No need to click the search box — typing while the Start menu is open searches automatically.) - When Windows PowerShell appears in the list, press
Enter.
A blue (or black) window opens with text like this:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\Lee>
The last line is the key. Read PS C:\Users\Lee> like this:
"PowerShell (PS) is waiting (>) for a command at the location C:\Users\Lee."
This line is called the prompt. From now on, when this book says "check the prompt," it means look at the path part of this line. This line is your "current location indicator." The single secret to never getting lost in the CLI is the habit of glancing at this line every time you type a command.
Note: if your username isn’t Lee, a different path will naturally appear. Read every
Leein this book as your own username.
3-2. First Command — Where Am I? Get-Location
Now let’s type a command. Type the following exactly and press Enter:
Get-Location
Result:
Path
----
C:\Users\Lee
The computer answered: "You are at C:\Users\Lee." You just issued a command to your computer and received an answer. That’s all a CLI is — ask, and be answered.
PowerShell commands follow a Verb-Noun form. Get-Location = "Get the Location." Thanks to this rule, you can guess the meaning of commands you’ve never seen before.
Abbreviation: there’s a shorter command with the same meaning.
pwd
Same result. pwd stands for "Print Working Directory," a name that came from Linux. PowerShell kindly understands several of these nicknames (aliases). This book mixes formal names and abbreviations.
3-3. What’s Here? — Get-ChildItem
Get-ChildItem
Result (yours may differ — that’s normal):
디렉터리: C:\Users\Lee
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2026-09-01 오후 3:20 Desktop
d----- 2026-09-01 오후 3:20 Documents
d----- 2026-09-02 오전 9:15 Downloads
...
How to read the result — you need to be able to read this table:
- The top line
디렉터리: C:\Users\Lee— "this is the place being shown" (on English Windows it appears asDirectory:) d-----inMode— if the first character isd, it’s a folder (directory); if it starts with-, it’s a fileLastWriteTime— when it was last modifiedName— the name
In other words, my home (C:\Users\Lee) contains folders like Desktop, Documents, and Downloads. It’s the same information you’d get by opening your folder in Explorer — the difference is you got it without a single mouse click.
Abbreviations: ls and dir do the same thing.
ls
Same result. (ls is the alias for Linux users, dir the alias for old-school DOS users. Use whichever you like. This book uses ls often — because the same command will work later on Linux.)
3-4. Moving — cd
cd (Change Directory) is the move command. Let’s go to the Documents folder:
cd Documents
Nothing comes back. In the CLI, "silence" often means "success." (Failure announces itself loudly in red.) Instead, look at the prompt:
PS C:\Users\Lee\Documents>
The path changed to ...\Documents — move successful. Just to check:
pwd
C:\Users\Lee\Documents
Let’s see what’s in the Documents folder:
ls
(The contents of your Documents folder appear. If it’s empty, nothing appears.)
Now let’s go back up one level, using the special symbol .. (one level up):
cd ..
pwd → C:\Users\Lee
We’re back home, one level above Documents.
3-5. Jumping with an Absolute Path
This time, instead of a relative path, let’s jump in one move using an absolute path written out from start to finish. (Replace the username with your own.)
cd C:\Users\Lee\Downloads
pwd → C:\Users\Lee\Downloads
No matter where you were, you arrived in one shot. That’s the power of absolute paths — the same address regardless of "where you are now."
Predict first: you’re in Downloads right now. Where will
cd ..\Documentstake you? ① Think about it → ② type it → ③ verify withpwd.
(Answer:..takes you one level up toC:\Users\Lee, then into Documents — soC:\Users\Lee\Documents.)
3-6. Paths with Spaces — The Quoting Rule
This time, let’s deliberately cause an error. Type this:
cd C:\Program Files
Result (actual message, Korean Windows):
Set-Location : 'Files' 인수를 사용하는 위치 매개 변수를 찾을 수 없습니다.
위치 줄:1 문자:1
+ cd C:\Program Files
+ ~~~~~~~~~~~~~~~~~~~
On English Windows, you’ll see an English message meaning A positional parameter cannot be found that accepts argument 'Files'.
Time to learn how to read an error. Red text is scary, but the content is helpful: "There’s no slot that accepts the argument ‘Files’." Wait — why was Files called out separately?
PowerShell treats a space as a separator between inputs. So it understood cd C:\Program Files as three pieces: "the cd command + C:\Program + Files." cd accepts only one destination, but it got two (C:\Program and Files), so it’s complaining about the extra one, Files.
The fix: wrap a path containing spaces in quotes to say "this is one chunk."
cd "C:\Program Files"
pwd → C:\Program Files
Success this time. "If a path has spaces, quote it" — one of the few rules worth memorizing today.
Let’s head back:
cd C:\Users\Lee
(Or wherever home is, typing cd $HOME takes you there. It’s a neat convention — try it once.)
3-7. Two Techniques to Type Less
How CLI veterans keep their typing to a minimum:
① Tab completion — don’t type the whole thing.
cd Doc[TAB]
Type Doc and press Tab, and PowerShell completes the rest as something like .\Documents\. If several names are similar, press Tab repeatedly to cycle through them. Most typos are prevented by completion.
② The up arrow (↑) — brings back commands you typed before. Press ↑ a few times to find the Get-ChildItem you typed earlier, and re-run it with Enter. No more "retyping that long command from before."
4. Missions & Exercises
Mission — CLI Review Marathon
With no help, using only today’s commands, do the following. (If you don’t know something, don’t scroll up right away — squeeze your memory first. That’s what builds skill.)
- Check your current location.
- Move to
C:\(the top level, the root). (Hint:cd \) - Run
lsthere and observe which folders live at the root of Windows. Do you seeWindows,Program Files,Users? — This is the top-level map of your computer. - Jump straight to your
Documentswith an absolute path. - Use
cd ..twice to get toC:\, then come back home withcd $HOME. - Finally: write down three commands you remember from today on paper (or in Notepad). As you write, say out loud, "what did this one do again?" If the words come out, you really know it.
Exercises
Exercise 1. You are at C:\Users\Lee. Write two ways — absolute and relative — to get to the Downloads folder.
Exercise 2. When you’re at C:\Users\Lee\Downloads, where do you end up if you run cd .. twice?
Exercise 3. Why does the following command fail? Fix it.
cd C:\Program Files\Common Files
Exercise 4. In Get-ChildItem output, is a line whose Mode starts with -a---- a folder or a file?
5. Model Answers & Completion Criteria
Mission Walkthrough
1: pwd, 2: cd \, 3: ls, 4: cd C:\Users\Lee\Documents (with your own name), 5: cd .. twice, then cd $HOME. The folders you saw in step 3 (Windows, Program Files, Users) are the top-level map of your computer. For step 6, be sure to say it out loud — if the words come out, you really know it.
Exercise Answers
Answer 1.
- Absolute path:
cd C:\Users\Lee\Downloads - Relative path:
cd Downloads
Answer 2. C:\Users. One cd .. takes you to C:\Users\Lee; two take you to C:\Users. If you’re unsure, type it and check with pwd — verifying is a skill too.
Answer 3. Because two spaces made PowerShell misread the path as several pieces. Wrap it in quotes:
cd "C:\Program Files\Common Files"
Answer 4. A file. If the first character is d, it’s a folder (directory); if it’s -, it’s a file.
Completion Checklist
- [ ] I can find and open PowerShell
- [ ] I can read my current location from the prompt
- [ ] I can check my location and contents with
pwdandls - [ ] I can move with
cdusing both relative and absolute paths - [ ] I can handle paths with spaces using quotes
- [ ] I’ve used Tab completion and the ↑ key
- [ ] I completed mission steps 1–6 and all 4 exercises without help
6. Common Pitfalls & Fixes
Wall 1. I ran cd and got "cannot find a positional parameter"
90% of the time the cause is typing a path with spaces without quotes (review 3-6). Wrap it: cd "Program Files".
Wall 2. I ran cd and got "Cannot find path"
This message means the path itself doesn’t exist. The causes are usually:
- A typo: like
Documants. Tab completion prevents this. - Wrong idea of where you are: there’s no such subfolder where you’re standing. Run
lsfirst to see what’s there.
Look at the path written in the error message ("Cannot find path ‘here’"), and you can see what the computer tried and failed to find. Errors aren’t enemies — they’re hints.
Wall 3. Korean text looks broken (shows as □)
This happens in some environments due to font issues. It doesn’t interfere with the exercises, so you can ignore it for now. We’ll fix it in the chapter on terminal settings.
Wall 4. I typed a command and nothing happened
Most of the time that means success. The CLI is normally quiet and only raises its voice (red text) when something fails. If you want confirmation, ask about the state with pwd or ls.
Wall 5. I don’t know where I am — panic
Memorize two all-purpose incantations:
pwd— where am I right now?cd $HOME— return home
7. Summary
Commands You Learned Today
| Command (formal) | Abbreviation | What it does | Example |
|---|---|---|---|
Get-Location |
pwd |
Show current location | pwd |
Get-ChildItem |
ls, dir |
List the current folder | ls |
cd path |
— | Move | cd Documents, cd .., cd "C:\Program Files" |
New Concepts
| Concept | One-line summary |
|---|---|
| CLI vs GUI | Driving with text vs driving with pictures |
| Prompt | PS C:\...> — your current-location indicator. Glance at it constantly |
| Absolute path | A complete address from the root |
| Relative path | An address from where you are now (.. = one level up) |
| Quoting rule | Wrap paths with spaces in " |
| Tab / ↑ | Completion / recall previous commands |
Instincts That Matter More Than Commands
"Silence means success; red text is a hint." And "when in doubt, type pwd." These two sentences alone dissolve half of CLI phobia.
One more thing — if you wondered why command names are long like Get-ChildItem, it’s thanks to the Verb-Noun rule. Rather than hundreds of short commands you’d have to memorize, the design chose long names you can guess from one rule. What was "create a folder" again? → create (New) + item (Item) = New-Item. A command you’ll meet in the next chapter.
Once every box is checked, Step 1 is complete. Click the checkbox in the sidebar to save your progress.