Seekvana
Building with AIbeginner

The 10 Terminal Commands You'll Use 90% of the Time

Learn the 10 most essential terminal commands for beginners: pwd, ls, cd, mkdir, touch, cp, mv, rm, cat, and clear, with syntax, examples, and common mistakes.

SeekvanaJune 20, 20268 min read
Terminal window showing a clean list of typed commands with an active line highlighted in clay orange against a warm cream background

Ten commands. That's all you need for 90% of what developers actually do in the terminal. These are the basic terminal commands for beginners — in this lesson, you'll learn what each one does, see it in action, and know the one mistake beginners make with it.

Key Takeaways

  • pwd shows you where you currently are in your file system, always run it first when you're lost
  • rm deletes files permanently with no Recycle Bin, there's no undo
  • ls, cd, and pwd are used together constantly, think of them as your GPS
  • Windows PowerShell uses New-Item instead of touch, and cls instead of clear in CMD (though clear works in PowerShell)
  • You don't need to memorize the syntax, bookmark this page and look it up as you go

Quick reference

Here's the full list at a glance. The sections below cover each one in detail.

CommandWhat it doesWindows note
pwdShow current folder pathSame in PowerShell
lsList files and foldersdir in CMD; ls in PowerShell
cdMove into a folderSame on all platforms
mkdirCreate a new folderSame on all platforms
touchCreate an empty fileUse New-Item in PowerShell
cpCopy a fileSame on all platforms
mvMove or rename a fileSame on all platforms
rmDelete a file permanentlySame on all platforms
catPrint file contents to screenSame on all platforms
clearClear the terminal screencls in CMD; clear in PowerShell

Before you type anything

Two things will save you from most beginner errors before they happen.

First: every command runs inside a folder. You're always "somewhere" in your file system, even when the terminal looks blank. That's why "no such file or directory" is the most common beginner error — you're looking for a file in the wrong place.

Second: file and folder names are case-sensitive on Mac and Linux. Notes.txt and notes.txt are different files. Windows is more forgiving, but get into the habit of matching case exactly.

If you're on Windows and a command gives you an error, make sure you're using PowerShell or Git Bash, not the old Command Prompt. Most commands here work in all three, but CMD has a few quirks.

Now, the which terminal to use on your OS lesson covers this in more depth. For now: open your terminal and let's go.


How do you navigate folders in the terminal?

These three commands are almost always used together. pwd tells you where you are, ls shows what's around you, cd moves you somewhere else. Think of them as your file system GPS.

pwd, print working directory

What it does: Shows the full path to the folder you're currently in.

pwd

Example output:

/Users/yourname/projects

Run pwd whenever you're lost. It's always the first thing to check.

ls, list files and folders

What it does: Lists everything inside your current folder.

ls

Example output:

my-app notes.txt README.md

On Windows CMD, the equivalent is dir. In PowerShell and Git Bash, ls works fine.

Common mistake: Expecting to see hidden files (names starting with .). Add the -a flag to see them: ls -a.

cd, change directory

What it does: Moves you into a different folder.

cd folder-name

Example, moving into a project:

cd my-app

Example, going up one level:

cd ..

Two dots means "the folder above this one." One dot means "this folder." You'll use .. constantly.

Common mistake: Folder names with spaces break cd unless you wrap them in quotes: cd "My Projects".

Pro tip: You don't have to type the full folder name. Type the first few letters and press Tab — the terminal fills in the rest. This is one of those things that immediately makes the terminal feel less scary.


How do you create files and folders in the terminal?

mkdir, make a new folder

What it does: Creates a new empty folder.

mkdir folder-name

Example:

mkdir my-project

That's it. Navigate into it with cd my-project.

Common mistake: Spaces in the folder name without quotes: mkdir my project creates two folders named my and project. Use hyphens instead: mkdir my-project.

touch, create a new empty file

What it does: Creates a new empty file, or updates the timestamp of an existing one.

touch filename.txt

Example:

touch notes.txt

Windows PowerShell: touch doesn't exist. Use New-Item notes.txt instead. Git Bash on Windows supports touch like Mac and Linux.

Common mistake: Running touch in Windows PowerShell, you'll get an error. Switch to New-Item, or install Git Bash.

This is how you create files without opening a code editor. When you're setting up a project, you'll run touch for config files, .env files, and READMEs constantly.


Moving and copying things

cp, copy a file or folder

What it does: Copies a file from one location to another. The original stays put.

cp source.txt destination.txt

Example, copy into a subfolder:

cp notes.txt backup/notes.txt

Common mistake: Copying without realizing you'll overwrite an existing file at the destination. The terminal won't warn you, it just overwrites.

mv, move or rename a file

What it does: Moves a file to a new location, or renames it if you keep it in the same folder.

mv old-name.txt new-name.txt

Example, rename:

mv notes.txt final-notes.txt

Example, move to a folder:

mv notes.txt archive/notes.txt

This one surprises people: mv is how you rename files in the terminal. There's no separate rename command.

Common mistake: Moving a file into a folder that doesn't exist yet. Create the folder first with mkdir, then move.


How do you delete files safely from the terminal?

rm, remove a file

What it does: Deletes a file permanently.

rm filename.txt

Example:

rm old-notes.txt

There's no Recycle Bin here. Deleted is deleted. One wrong rm command won't destroy your hard drive — it only removes exactly what you name. But it won't ask for confirmation either.

To delete a folder and everything inside it, add the -r flag (recursive):

rm -r my-folder

rm -r deletes the folder and all its contents in one go. Double-check the folder name before you run it.

Common mistake: Running rm my-folder on a folder without -r, you'll get an error: "is a directory." Add -r.

cat, print file contents

What it does: Prints the contents of a file directly in the terminal.

cat filename.txt

Example:

cat notes.txt

Output:

This is what's in notes.txt.

Useful for quickly checking what's inside a file without opening a code editor. For longer files, the output scrolls past fast, use less instead (but that's beyond this lesson).

Common mistake: Running cat on an image or binary file. You'll get a screen full of garbled characters. It won't break anything, just looks alarming.


One more: clear the screen

clear, clear the terminal

What it does: Wipes the terminal screen so you have a clean slate. Your commands still ran, this just clears the visual clutter.

clear

On Windows CMD, the equivalent is cls. In PowerShell and Git Bash, clear works fine.


Your Task

Create a folder, create a file, then delete it

In your terminal, run these commands one at a time:

mkdir my-test-folder
cd my-test-folder
touch notes.txt

(Windows PowerShell: use New-Item notes.txt instead)

ls
cd ..
rm -r my-test-folder

You created a folder, navigated into it, made a file, listed it, went back up one level, and deleted the whole thing, entirely from the keyboard. That's the core workflow you'll repeat hundreds of times as a developer.

Done? You've completed Lesson 02.03. Next up: Absolute vs Relative File Paths

Working through the full path? Head back to the Getting Started path to see where you are.

FAQ

Common questions

  • Yes, on Mac, Linux, and Windows PowerShell, rm (or Remove-Item) permanently deletes without sending files to the Recycle Bin. There is no undo. Before running rm on anything important, double-check the filename. If you're nervous, move the file to a backup folder with mv first, then delete it once you're sure.

  • cp copies a file, the original stays exactly where it was, and a copy appears at the destination. mv moves or renames a file, the original disappears from its current location. If you want to keep the original and also have a copy elsewhere, use cp. If you want to rename or relocate the file, use mv.

  • No. Professional developers look up command syntax regularly, that's not a sign of inexperience, it's just how the job works. What matters is knowing which command to reach for when you need to do something. Bookmark this page and refer back to it. After a few weeks of regular use, the ones you use most will stick naturally.

  • Most commands here (pwd, ls, cd, mkdir, cp, mv, rm, cat, clear) work on Mac, Linux, and Windows PowerShell. The main exceptions: touch doesn't exist in PowerShell, use New-Item instead. clear works in PowerShell but Windows CMD uses cls. If you're following along on Windows and hitting errors, make sure you're using PowerShell or Git Bash, not the older Command Prompt.

Finished reading?

Mark it complete to track your progress through the path.


Was this article helpful?

Comments (0)

0/1000

Be the first to leave a comment.