๐Ÿ–ฅ๏ธ

Hello World in Terminal

๐Ÿง‘โ€๐ŸŽ“ Apprenticeโฑ๏ธ 10 minutes

๐Ÿ“‹ Suggested prerequisites

  • โ€ขNone

What you'll build

You'll learn the basic terminal commands that every developer needs. You'll navigate between folders, create and edit files, and run programs from the command line. These are the foundational skills you'll use every day as a programmer. By the end, you'll have lost your fear of the black screen and gained confidence using the terminal.


Step 1: Open the terminal

SystemHow to open
macOSCmd + Space โ†’ type "Terminal"
WindowsWin + X โ†’ "Terminal" or "PowerShell"
LinuxCtrl + Alt + T

Step 2: Your first command

Type this and press Enter:

echo "Hello World"

You should see:

Hello World

That's it. You ran a command.


Essential commands

CommandWhat it doesExample
pwdShows where you arepwd โ†’ /Users/your-name
lsLists filesls โ†’ Documents Downloads ...
cdChanges foldercd Documents
mkdirCreates foldermkdir my-project
touchCreates empty filetouch hello.txt
catShows contentcat hello.txt
clearClears screenclear

Practice: Create your first folder

# Create a folder
mkdir my-first-project

# Enter the folder
cd my-first-project

# Create a file
echo "Hello from the terminal!" > greeting.txt

# See the content
cat greeting.txt

Folder navigation

CommandWhat it does
cd folderEnter folder
cd ..Go up one level
cd ~Go to your home
cd -Go to previous

If something failed

ErrorCauseSolution
command not foundMisspelled commandCheck spelling
No such file or directoryFolder doesn't existUse ls to see what's there
Permission deniedNo permissionsUse sudo (carefully)

Tips

  • Use Tab to autocomplete names
  • Use up arrow to repeat previous commands
  • Use Ctrl+C to cancel a command

What did you learn?

The terminal isn't magic. They're text commands:

  1. You type a command
  2. You press Enter
  3. You see the result

Next step

โ†’ My First Repository โ€” Save your code with Git