STR Coding Club logo STR Coding ClubLearn to code, together
First Steps

How to Use the Command Line as a Complete Beginner

You followed a Python tutorial, it said "open your terminal and type this", and you stared at a black window with a blinking cursor and no idea what was allowed. That moment stops more new coders at our club than any syntax error ever does.

A student at a desk looking at a laptop with a dark terminal window open next to a notebook of handwritten commands

You followed a Python tutorial, it said "open your terminal and type this", and you stared at a black window with a blinking cursor and no idea what was allowed. That moment stops more new coders at our club than any syntax error ever does.

The command line is just a text way to do things you already do with a mouse: open folders, list files, run programs. This guide teaches the eight commands you actually need in your first month, how to read what the terminal tells you, and how to avoid the two mistakes that scare beginners off for good.

What the command line actually is

When you double click a folder, your computer opens it and shows you the files inside. The command line does the same thing, except you type the instruction instead of clicking. The program that shows the window is called a terminal. The program inside it that reads your typing is called a shell.

On Windows you will usually use PowerShell or Command Prompt. On macOS it is the Terminal app running a shell called zsh. On Linux it is usually bash. The commands differ slightly between Windows and the other two, and I will point out where.

The line that ends in a symbol like a dollar sign or an arrow is the prompt. It also shows where you are right now, called the current directory. Everything you type runs from that location, which is the single most useful fact in this whole article.

The eight command line basics for your first month

TaskmacOS and LinuxWindows PowerShell
Show where you arepwdpwd
List files herelsls or dir
Go into a foldercd projectscd projects
Go up one levelcd ..cd ..
Make a foldermkdir clubmkdir club
Make an empty filetouch notes.txtni notes.txt
Run a Python filepython3 hello.pypython hello.py
Clear the screenclearcls or clear

That is it. Our club organiser counted once: in the first six weeks of the beginner track, students used those eight commands for roughly 95 percent of everything they typed.

A ten minute practice session

Do this once, slowly, and the terminal stops feeling like a locked door. Type each line and press Enter.

  1. Type pwd. You will see something like /Users/sam or C:\Users\sam. That is your home folder.
  2. Type mkdir codeclub. Nothing prints. In the command line, silence usually means success.
  3. Type cd codeclub, then pwd again. Notice the path now ends in codeclub.
  4. Create a file called hello.py in this folder using your code editor, with one line inside: print("hi from the terminal").
  5. Type ls. You should see hello.py listed.
  6. Type python hello.py (or python3 on a Mac). The message prints.
  7. Type cd .. to go back up, then ls to see codeclub as a folder in your home directory.

If step 6 fails with "No such file or directory", you are almost certainly in the wrong folder. Run pwd and ls to check. That one habit fixes most terminal confusion we see on club nights.

Reading what the terminal tells you

The terminal does not do friendly pop ups. It prints text, and that text is information, not a judgement. Three messages cover most beginner trouble:

  • "command not found" or "is not recognized". You either made a typo or the program is not installed. Check spelling first. Then check that Python is installed by asking Python for its version number, which the install guide for your system will show you how to do.
  • "No such file or directory". The file is not in your current folder. Use ls to see what is actually there.
  • "Permission denied". You are trying to change something the system protects. As a beginner, you almost never need to fix this. Work inside your own home folder instead.

When Python itself errors, you get a traceback, which is a different kind of message. Our guide on how to read a Python error message when you are new walks through one line by line.

Two habits that save hours

Use Tab to finish names

Type cd cod and press Tab. The shell fills in codeclub for you. This avoids typos and also proves the folder exists. If Tab does nothing, the name you started does not match anything in the current folder.

Use the up arrow to repeat commands

Pressing the up arrow brings back the last command. Press it again for the one before. When you are running the same script twenty times while fixing a bug, this saves real time.

Why you do not need to memorise a long command list

Plenty of beginner guides hand you a cheat sheet with 50 or 60 commands and tell you to learn them all before writing code. I think that is backwards, and it puts people off.

Memorising commands you have no reason to use does not stick. You forget grep, chmod and find within a week because nothing in your day needs them. Learn the eight above, write real programs, and pick up new commands only when a project asks for one. When you set up version control for a club project, you will learn a handful of git commands in context, and they will stay with you because you used them that evening. Our walkthrough on running a Git group project at your coding club is a good place to meet them.

The same goes for scary looking flags like -rf. You do not need them in month one. If a tutorial asks you to paste a command you do not understand, especially one that starts with rm or sudo, pause and ask someone first.

Where to go next

Once these basics feel normal, a few small steps build on them nicely. Open the terminal built into your code editor so your files and commands sit side by side. Try running a script with an argument, such as python greet.py Sam, and read the name inside your program. Then practise moving between two project folders without using the mouse at all for a whole session.

If you are still deciding what to study after this, what to learn first when you know nothing about coding lays out a sensible order.

Frequently asked questions

Is the command line the same as coding?

Not exactly. The command line is a tool for telling the computer what to do, including running the code you write. You can write code without using it much, but most tutorials and real projects expect at least the basics, so learning a few commands early removes a common roadblock.

Can I break my computer using the command line?

It is possible, but very unlikely with beginner commands like ls, cd, mkdir and python. The risky ones are delete commands and anything run with administrator rights. Stay inside your own folders and do not paste commands you do not understand.

Should beginners use PowerShell or Command Prompt on Windows?

PowerShell is the better choice for most beginners today. It accepts common commands like ls and pwd that tutorials use, and it comes installed on every recent version of Windows. Command Prompt still works, but you will find fewer modern guides written for it.

BN
Bartholomew Ng

Bartholomew taught maths for years before switching to teaching Python. He writes about the basics of the language and about teaching code without drowning learners in syntax.

More posts by Bartholomew

More in First Steps

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp foxstudiosscratch gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven tetapatrium topselller uneplanteartificielle vipertechcr webtech1223411 wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto