Terminal is the program that lets you control your Mac with typed commands instead of the mouse. For daily use you do not need it, but some handy tricks and fixes only work through Terminal. This article explains how to open Terminal on your Mac, a few simple commands to start with, and what to be careful with.
Blue Apple repairs MacBooks in Amsterdam. We regularly see Macs that got problems after someone pasted a command from the internet into Terminal. That is why safety comes first in this article.
Opening Terminal
- Via Spotlight: press Command + Space bar, type "terminal" and press Return.
- Via the Finder: Applications, Utilities, Terminal.
You see a window with a line ending in % or $. That is where you type commands, which you run with Return.
Simple commands to try
- pwd: shows which folder you are in.
- ls: lists the files in that folder.
- cd Documents: go to the Documents folder. cd .. goes back one folder.
- open .: opens the current folder in the Finder.
- say hello: your Mac speaks the word.
- caffeinate: keeps your Mac awake while Terminal is open. Stop with Control + C.
Control + C stops a command that keeps running. The up arrow brings back earlier commands.
Handy uses
- Flushing the DNS cache when websites will not load. See clearing the DNS cache on a Mac.
- Making a bootable USB stick with createinstallmedia. See making a bootable USB stick.
- Resetting a password in Recovery mode with resetpassword. See forgot your password.
Safety: read this before you paste anything
- Never paste a command you do not understand, certainly not from an unknown site, a video comment or a "helpdesk" you did not call yourself. With one command someone can delete files or install malware.
- Be extra careful with sudo. A command starting with sudo runs with administrator rights and can change anything on your Mac. That is why it asks for your password.
- rm deletes immediately, without the Bin and without undo.
- If a pop-up or website says your Mac is infected and you must paste a command into Terminal, it is almost certainly a scam.
Files and folders in Terminal
You do not have to type long paths. Drag a file or folder from the Finder into the Terminal window and the full path appears. The Tab key completes a name you start typing. If a name contains a space, put it in quotation marks.
Making Terminal nicer or handier
In Terminal settings choose another profile (colours and font) and a larger font size. Command + plus makes the text bigger temporarily. Command + T opens a new tab.
When do you not need Terminal?
For almost everything you do daily there are buttons and menus in macOS. A "fix" via Terminal is not always better. When a Mac is slow, freezes or does not charge properly, the cause is often something else. Read MacBook keeps freezing.
What we do at Blue Apple in Amsterdam
If you ran a command and your Mac no longer works properly, or no longer starts, we look at what changed and what can be restored, your files included. More on our pages about MacBook repair in Amsterdam and MacBook data recovery.
Frequently asked questions
Why do I see nothing when I type my password?
That is a safety feature: Terminal shows no characters for passwords. Just type it and press Return.
Can I undo Terminal commands?
Usually not. So think first, and if in doubt do not run it.
What is the difference between Terminal and the Windows command prompt?
The idea is the same, but the commands differ. The Mac uses Unix commands.