Chapter 6
The Command Line
Open a Terminal and Ask Where You Are
Your computer already has a
Which application it is, and which
Open it
Open the Start menu, type PowerShell, and choose Windows PowerShell or PowerShell 7. Either is fine, and every command in this chapter works in both. In Windows Terminal, pick a PowerShell profile from the tab menu.
Do not use Command Prompt here. It is a different shell speaking a different language, and its commands will not match anything in this chapter.
Press Command + Space, type Terminal, and press Enter. You can also open Finder, then Applications, then Utilities, then Terminal.
Current
Try Ctrl + Alt + T first, which many desktops bind to a terminal. If nothing opens, search your applications menu for terminal. The usual names are Terminal, GNOME Terminal, Konsole, and Xfce Terminal.
Most distributions start Bash, though yours may be set up differently. This chapter’s commands behave the same either way.
The window that opens shows a prompt, which is the shell saying it is ready for the next thing. Prompts are configurable, so yours will not match anyone else’s exactly:
PS C:\Users\Sam>
The PS is the useful clue: this is a PowerShell session. The path is where the shell is currently standing, and the final > is prompt text.
sam@computer ~ %
The % is zsh’s usual prompt symbol, and Bash normally uses $. Everything before it is decoration your shell configuration chose.
sam@computer:~$
The $ at the end is the common prompt symbol. The username, machine name, and location in front of it are decoration your shell configuration chose.
Whatever it looks like, the prompt is output, not something you type. Documentation that shows a prompt in front of a command is giving you context; copy only what comes after it.
Ask one harmless question
The first useful command reports the working directory, which is the folder the shell is standing in and the place every
Click into the terminal beside this lesson and run it:
Get-Location
Get-Location is a cmdlet, which is what PowerShell calls its built-in commands. Cmdlet names follow a Verb-Noun shape: Get retrieves something, Location is the thing retrieved, and the hyphen joins them into one name. The shape gives you a useful first clue, while the command’s help remains the authority on what it actually does.
pwd
pwd is short for “print working directory”.
pwd
pwd is short for “print working directory”. Unix command names are terse by tradition, which is quick to type and worth translating in your head the first few times.
In a fresh workspace the answer is /workspace. Run it a second time and you get the same answer, because asking a question changed nothing. That is the habit this whole chapter is built on: look before you touch.
Two terminals, two machines
The terminal beside this lesson is not the terminal on your own computer. It is a disposable hosted sandbox holding this chapter’s practice files, and it starts at /workspace.
Run the same command in your own terminal and you will get something else: a Windows path such as C:\Users\Sam, or /Users/sam on a Mac, or /home/sam on
Both answers are correct, and the difference is the point. The graded work happens in the sandbox, where the starting conditions are known and nothing you do can reach anything you own.
You open the lesson terminal, and the first command you run reports /workspace. What have you learned?
You have a terminal open, you can tell the prompt from the answer, and you have asked the shell one question that changed nothing. Next, the three questions worth asking in order: where am I, what is here, and how do I get somewhere else.