Terminal is an application that gives you access to the Mac's inner working via a command line interface (CLI). Using this app gives you the ability to make lots of changes to the operating system that isn't available from the graphical user interface (GUI). It's generally not meant for the average customer. Instead, it serves as a great tool for power users and developers.
Still, if you're curious, this article shows you how to open Terminal on Mac and use basic commands.
The instructions in this article are demonstrated using macOS 10.15 Catalina. The commands should apply in Terminal on any Mac computer.
What Is Terminal?
Terminal is an emulator providing a command-line interface. It's similar to PowerShell in Microsoft Windows, which replaced Command Prompt (MS-DOS) in 2017. macOS is based on the Unix operating system originally built by AT&T for the Bell System. Terminal uses the Bash shell by default.
A “shell” is another word for interface, whether it's text-based or full of graphics. Since Terminal emulates the command-line environment, the shell creates the visual interface within the emulation. For macOS, the default shell is Bash (Bourne-Again Shell), though you can switch to Z Shell (or zsh) using a command.
Everything you see in macOS stems from a graphical user interface. Rather than enter commands, you have windows managed by a mouse and keyboard. Touchscreens, gestures, digital pens, and more make interactions even easier. Why bother typing commands into an old-school interface?
The simple explanation is you can do anything using commands, like change the default storage location for your screenshots, play games, make the Mac talk, show hidden folders, and more. More importantly, commands are faster because they're direct.
The GUI generating all the macOS windows and menus, however, targets ease and simplicity, not speed. While you're dragging a file from window to window, using a command line to perform the same move may be quicker.
How to Open Terminal
Terminal typically resides on the Dock. The icon resembles a command-line input screen with a white > (greater than) symbol set against a black background.
You can also access the Terminal app through the Launchpad.
Click the “rocket” icon located on the Dock. This opens the MacOS Launchpad.
Click the Other folder.
Click the Terminal app.
Here are a few basic command-line starters. They're action words like copy, move, and list. Some of these aren't used in the examples below. Instead, this list merely illustrates how commands begin.
There's no simple "undo" for terminal commands, so make sure you are comfortable using this before really making changes to your system.cat – List the contents of a file or foldercd – like DOS, use this command to change directoriescp – Copy a file or folderdefaults – This command changes settings not listed under Preferencesls – this command lists a directory's contentmkdir – Make a directorymv – Move a file or foldernano – Open the Terminal editorssh – short for Secure Shell, this command creates a secure encrypted connection between two hosts.sudo – upgrades your command with administrative (superuser) privileges and requires a password. Be careful, however, as incorrect commands could damage macOS and require a fresh install.
Commands to Get You Started
Here are fun and useful commands to get you started. These include keeping your Mac awake, watching an ASCII version of Star Wars Episode IV, and a few others.
To execute these commands, you must finish by pressing the Enter key. We noted this key in commands that require more than one entry.
View the Contents of a File or Directory
This is handy if you want to see the contents of a ZIP file or executable before it's unpacked. Insert your file or folder location after the ~ (tilde) symbol.cat ~/file/path/here
Increase Update Frequency
The number at the end represents the number of days the Mac will wait to check for updates. MacOS typically checks once a week, so the default number is 7 at the end. In this example, the Mac will check once a day.defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
Keep your Mac Awake
Since your Mac can't drink coffee, the next best way to keep it awake is to feed it a caffeinated command. This will force it to remain awake indefinitely.Caffeinate
To stop, type the CTRL + C keys.
If you want to keep your Mac awake for a specific time, use the following example. Here we chose 250,000 seconds (which is not quite three days for those who are curious).Caffeinate -t 250000
Watch a Text Version of Star Wars: A New Hope
This is just fun. You may not sit through the whole show, but it's amazing to see this classic film portrayed using an animated ASCII format like you're in the early 1980s.nc towel.blinkenlights.nl 23
Change the Screenshot Format
PNG is the default format. Use this command to save screenshots in JPG, GIF, or another file format.defaults write com.apple.screencapture type jpg
Change the Default Screenshot Name
MacOS saves screenshots with the date and time listed in the file name. Use this command to create a default file name that's not so ugly and long.defaults write com.apple.screencapture name "New Screen Shot Name"
Change the Screenshot Save Destination
Screenshots save to the desktop by default. Use this command to change the target storage location, like a dedicated folder.defaults write com.apple.screencapture location ~/your/location/here
Press the Enter key.killall SystemUIServer
Remove the Screenshot Drop Shadow
If you take screenshots of an open window using the Command + Shift + 4 + Spacebar command, MacOS adds a drop shadow when you click on that window. If you don't want this effect, use the following command:defaults write com.apple.screencapture disable-shadow -bool TRUE ; killall SystemUIServer
To reenable the effect, type this command:defaults write com.apple.screencapture disable-shadow -bool FALSE ; killall SystemUIServer
Chime Like an iPhone Connecting to Power
Here's a little command-line fun for iPhone owners.defaults write com.apple.PowerChime ChimeOnAllHardware -bool TRUE; open /System/Library/CoreServices/PowerChime.app
To disable the chime, type the following and press the Enter key:defaults write com.apple.PowerChime ChimeOnAllHardware -bool FALSE; killall PowerChime
Make your Mac speak
This serves no purpose other than to entertain children with the Mac's mechanical voice. You do not need the quotation marks in the command. (Be sure the replace the sentence in quotation marks with whatever you want the computer to speak.)Say “Type your cool sentence here”
Download Files from the Internet
Don't want to download files using a browser? Take this route instead.cd ~/Downloads/
Press the Enter key and enter this command. The press the Enter key again once you've entered the command.curl -O [URL of file to download]