ShareYourGroupShareYourGroupCommands

Guides

Getting started with the command line

The command line is a way of telling the computer what to do by typing, instead of clicking. It looks old-fashioned and is still in daily use, because for many jobs it is faster, it can be repeated exactly, and it works when nothing else does. This guide gets you from never having opened it to running your first commands safely.

Opening it

SystemProgramHow to open
WindowsCommand Promptpress the Windows key, type cmd, press Enter
WindowsPowerShell or Windows Terminalpress Win + X and choose Terminal
MacTerminalpress Cmd + Space, type terminal, press Enter
LinuxTerminalpress Ctrl + Alt + T on most desktops, or search for Terminal

A window opens with a line of text ending in a symbol and a blinking cursor. That line is the prompt. It is the computer waiting for you.

Reading the prompt

On Windows it looks like C:\Users\asha>. On Linux and the Mac, something like asha@pc:~$. Either way it tells you which folder you are in. The ~ on Linux and the Mac means your home folder. Everything you type happens in that folder unless you say otherwise.

How a command is built

A command is a line of words, run when you press Enter.

command options arguments

Spaces separate the parts. That is why a name containing a space must go in quotation marks.

Make a practice folder first

Do your learning in a folder that holds nothing you care about. Then no mistake can cost you anything.

On Windows:

Windows Command Prompt
C:\Users\asha\demo>mkdir practice
C:\Users\asha\demo>cd practice
C:\Users\asha\demo\practice>echo hello > first.txt
C:\Users\asha\demo\practice>dir /b
first.txt
C:\Users\asha\demo\practice>type first.txt
hello 

On Linux or a Mac:

Linux or Mac terminal
asha@pc:~/demo$ mkdir practice
asha@pc:~/demo$ cd practice
asha@pc:~/demo/practice$ echo hello > first.txt
asha@pc:~/demo/practice$ ls
first.txt
asha@pc:~/demo/practice$ cat first.txt
hello

You have made a folder, gone into it, created a file and read it back.

The first ten commands

JobWindowsLinux and Mac
where am I?cdpwd
list this folderdirls
go into a foldercd namecd name
go up one levelcd ..cd ..
make a foldermkdir namemkdir name
show a text filetype filecat file
copy a filecopy a bcp a b
move or renamemove a b, ren a bmv a b
clear the screenclsclear
get helpcommand /?man command

Notice that deleting is not on the list. Leave it until the rest feels comfortable.

Keys that save effort

Copying and pasting

In the Windows Command Prompt and Windows Terminal, Ctrl + C and Ctrl + V work, and a right-click pastes. On a Mac, use Cmd + C and Cmd + V. In Linux terminals, copy and paste are Ctrl + Shift + C and Ctrl + Shift + V, because Ctrl + C already means "stop".

When something goes wrong

Read the message. Command-line errors are short and usually exact.

MessageMeaning
"is not recognized as an internal or external command" (Windows), "command not found" (Linux, Mac)the command's name is misspelt, or the program is not installed or not on the PATH
"The system cannot find the file specified", "No such file or directory"wrong name, or you are in a different folder from the one you think
"Access is denied", "Permission denied"you are not allowed to do that to that file
nothing happens and the prompt does not returnthe command is waiting or still working: press Ctrl + C

Staying safe

The command line does exactly what it is told, at once, and mostly without asking. Four habits prevent nearly every accident.

  1. Know where you are before a command that changes anything. Look at the prompt, or run cd on Windows and pwd elsewhere.
  2. Look before you delete. List the files with the same pattern first.
  3. Do not paste commands you do not understand. Read our page on dangerous commands to see why.
  4. Practise on copies, in your practice folder.

Which command line?

Windows has two: the older Command Prompt, and PowerShell, which is more capable. The Windows pages on this site use the Command Prompt, since its commands are the ones most often quoted in instructions. The guide to PowerShell shows how they correspond. The Mac and Linux share almost all their commands, so one set of pages serves both.

Where to go next

Work through the pages in this order: listing files, moving between folders, copying and moving, reading text files, searching. By then the command line will feel like a tool and not a test.

Examples shown with output were run on 12 November 2026 in a practice folder: Windows commands in cmd.exe on Windows 11, Linux commands with the GNU tools of Git Bash. The folder path and user name were replaced with made-up ones. Commands marked "not run here" are shown as you would type them.

This is an independent learning site. It is not connected with Microsoft, Apple or any Linux distribution. Windows, macOS and other names belong to their owners. Try commands first in a practice folder, never on files you cannot afford to lose.