What you'll learn
- Quick answer
- Why terminal commands for developers matter
- 1-4: Moving around (pwd, ls, cd, clear)
- 5-7: Creating things (mkdir, touch, echo)
- 8-10: Copy, move, and delete (cp, mv, rm)
- 11-14: Reading files (cat, less, head, tail)
- 15-16: Searching (grep, find)
- 17-20: Power tools (pipe, redirect, wc, man)
- Cross-platform notes: Windows, Mac, and Linux
- How to actually remember these
- FAQ
Quick Answer
The terminal lets you control your computer by typing commands, and about 20 of them cover most day-to-day coding work. Start with navigation (cd, ls, pwd), file operations (mkdir, cp, mv, rm), viewing (cat, less), and searching (grep, find), then combine them with pipes. These commands work almost the same on Mac and Linux, and Windows users can get the same experience with PowerShell or Git Bash.
Why terminal commands for developers matter
The terminal — also called the command line, shell, or console — is a plain text window where you type instructions instead of clicking buttons. It looks intimidating the first time you open it, but it is one of the fastest and most reliable ways to work once a few commands stick.
Almost every serious developer tool assumes you can use it. You install packages, run servers, commit code with Git, and deploy to servers from the command line. Tutorials, error messages, and documentation are written expecting you to know it too. That is why terminal commands for developers are a foundational skill, not an advanced one.
The good news: you do not need to memorise hundreds of commands. This guide covers 20 that handle most everyday work. Try each one in your own terminal as you read — muscle memory beats reading every time.
1-4: Moving around (pwd, ls, cd, clear)
Your terminal is always "sitting" in one folder, called the current directory. These four commands let you see where you are and move around.
pwd— print working directory. Shows the full path of where you are right now.ls— list the files and folders in the current directory.cd— change directory. Moves you into another folder.clear— wipes the screen clean when it gets cluttered.
pwd # where am I?
ls # what is in here?
ls -la # long list, including hidden files
cd projects # go into the projects folder
cd .. # go up one level to the parent folder
cd ~ # jump to your home folder
clear # tidy the screenTwo shortcuts that save real time: type the first few letters of a folder and press Tab to auto-complete the name, and press the Up arrow to bring back your previous command.
5-7: Creating things (mkdir, touch, echo)
Once you can move around, the next step is making files and folders without leaving the keyboard.
mkdir— make directory (folder).touch— create a new empty file.echo— print text, or write text straight into a file.
mkdir my-app # make one folder
mkdir -p src/components # make nested folders in one go
touch index.html # create an empty file
echo "Hello" > notes.txt # write "Hello" into a new fileA quick heads-up for Windows: touch does not exist in plain PowerShell. Use New-Item index.html instead, or install Git which comes with Git Bash where touch works normally. More on cross-platform differences below.
8-10: Copy, move, and delete (cp, mv, rm)
These three do the heavy lifting of organising your files.
cp— copy a file or folder.mv— move a file, or rename it (moving to a new name is the same thing).rm— remove (delete) a file or folder.
cp index.html backup.html # copy a file
cp -r src src-copy # copy a whole folder (-r = recursive)
mv old.txt new.txt # rename a file
mv report.txt ../docs/ # move a file into another folder
rm temp.txt # delete a file
rm -r old-folder # delete a folder and everything in itBe careful with
rm. There is no Recycle Bin or Trash on the command line — deleted files are gone. Double-check the path before pressing Enter, and be extra slow withrm -r. Never runrm -rf /or paste delete commands you found online without understanding them.
11-14: Reading files (cat, less, head, tail)
You will often want to peek inside a file without opening an editor. These four cover it.
cat— dump a file's entire contents to the screen. Great for short files.less— open a file in a scrollable viewer. Great for long files.head— show the first few lines.tail— show the last few lines.
cat notes.txt # print a short file
less server.log # scroll a long file (press q to quit)
head -n 20 data.csv # first 20 lines
tail -n 50 error.log # last 50 lines
tail -f server.log # follow a file live as it growsThat last one, tail -f, is a favourite for watching a server or app log update in real time while you test. Inside less, use the arrow keys or Page Up/Down to move, and press q to quit.
15-16: Searching (grep, find)
As projects grow, finding things by hand stops working. Two commands solve this.
grep— search inside files for a piece of text.find— search for files and folders by name or type.
grep "error" server.log # find lines containing "error"
grep -i "todo" app.js # -i = ignore upper/lowercase
grep -rn "apiKey" src/ # search a whole folder, show line numbers
find . -name "*.js" # every .js file under the current folder
find . -type d -name assets # find folders named "assets"The dot (.) in find means "start from the current folder". grep -rn is one you will reach for constantly — for example, to find every place you used a variable across a project.
17-20: Power tools (pipe, redirect, wc, man)
The real magic of the terminal is joining small commands into bigger ones. Four final building blocks unlock that.
|(the pipe) — send the output of one command into the next as input.>and>>(redirect) — send output into a file instead of the screen.>overwrites,>>adds to the end.wc— word count; with-lit counts lines.man/--help— read the manual for any command.
ls | grep ".png" # list only the PNG files
cat access.log | grep "404" | wc -l # count how many 404 errors
echo "deploy done" >> log.txt # append a line to a file
man ls # full manual (press q to quit)
ls --help # shorter help, works on Windows tooRead that middle example left to right: take the log, keep only the lines with "404", then count them. Each command does one small job; the pipe chains them into an answer. Once this clicks, you can build quick tools out of pieces you already know — no scripting required.
Cross-platform notes: Windows, Mac, and Linux
Mac and Linux both use the same family of shells (Bash or Zsh), so nearly every command above works identically on them. Windows is the odd one out: its old Command Prompt (CMD) uses different command names, and PowerShell is a mix — it accepts many familiar names as aliases but not all of them.
The simplest fix for Windows learners: install Git, which includes Git Bash, or turn on WSL (Windows Subsystem for Linux). Both give you a real Linux-style shell where every command in this guide works exactly as shown.
| Task | Mac / Linux / Git Bash | Windows CMD |
| List files | ls | dir |
| Clear screen | clear | cls |
| Copy a file | cp | copy |
| Move / rename | mv | move / ren |
| Delete a file | rm | del |
| Show current path | pwd | cd (with no folder) |
PowerShell understands ls, cat, cd, and clear as aliases, so you can often follow along there too. When something behaves oddly on Windows, Git Bash is the safest place to practise.
How to actually remember these
Reading a list will not make these stick — using them will. Here is a practical way to build the habit:
- Use the terminal for one real task a day. Create a project folder with
mkdir, move files withmv, check a log withtail. Small, repeated reps beat cramming. - Lean on Tab and the Up arrow. Tab completes names; the Up arrow re-runs history. You will type far less than you expect.
- When stuck, ask the command itself.
ls --helporman grepshows every option — no need to search the web for basics. - Learn Git next. Version control is where these commands pay off daily, and it is the natural next step after the basics.
You do not need to master all 20 today. Keep this page open as a cheat sheet, type the examples in your own terminal, and within a week the common ones will feel automatic. That is the whole skill — small commands, used often.
Frequently Asked Questions
Do I need to memorize all terminal commands?
No. Nobody memorizes every command — even experienced developers look up options they use rarely. Focus on the everyday 20 in this guide: navigation, file operations, viewing, and searching. Everything else you can find with --help, man, or a quick search when you actually need it.
Is Command Prompt the same as the terminal?
Roughly, yes — they are all text windows for typing commands. On Mac and Linux the app is called Terminal and it runs a shell like Bash or Zsh. On Windows, Command Prompt (CMD) and PowerShell are the built-in options, but they use some different command names. For the smoothest experience on Windows, install Git Bash or enable WSL so the Linux-style commands in this guide work as written.
Which terminal should I use on Windows?
For learning, Git Bash is the easiest choice — it comes free with the Git installer and behaves like Mac and Linux, so every command here works. WSL (Windows Subsystem for Linux) is the more powerful option if you want a full Linux environment. PowerShell also works for many basics because it accepts common aliases like ls and cat.
Is rm really permanent — is there no undo?
Yes, it is permanent. Files deleted with rm do not go to the Recycle Bin or Trash, and there is no built-in undo. Always read the path twice before pressing Enter, be especially careful with rm -r on folders, and never paste delete commands you found online without understanding exactly what they target.
Do I even need the terminal if I use VS Code?
Yes. Editors like VS Code handle writing code, but installing packages, running servers, using Git, and deploying almost always happen in a terminal — and VS Code has one built in for exactly that reason. Learning these commands makes you faster inside your editor, not just outside it.
What does the pipe symbol do?
The pipe (|) sends the output of one command straight into the next as its input, letting you chain small commands into a bigger one. For example, ls | grep ".png" lists files and then keeps only the ones ending in .png. Reading a pipeline left to right tells you exactly what each step does.
