Mac computers control 10 percent of the personal computer market. It’s easy to see why: Macs are easy to use, fast, powerful, and rarely go wrong. But are you getting the most out of your machine?
We’re all used to the polished user interface of Macs, but they can be quite restrictive. This is not a problem, it’s a feature, quite literally. It means that less advanced users are less likely to cause serious problems for themselves.
If you’re a power user, you need to know how to break free of these restrictions. The answer lies in Terminal. This powerful feature lets you do pretty much anything, dramatically improving your flexibility.
Once you get used to it, it’s quicker than using the UI too.
Ready to learn how to open Terminal on Mac? Want to be able to do anything and everything with your machine? Then read on!
What Is Terminal?
Terminal is the macOS’s equivalent to the Windows command prompt or Linux’s terminal. You can, therefore, define Terminal as a command-line interface.
The program takes your commands and then hands them on to the operating system. There is no graphical interface, which can slow them down.
All you have in front of you when using Terminal is a text interface. This is computing at its most basic. It is also computing at its most powerful.
How to Open Terminal on Mac
It’s easy to open Terminal on Mac. Open up the Applications menu and navigate to the Utilities folder. Double-click on Terminal.
If you’d prefer, you can also find and open Terminal with Spotlight.
The Terminal window will open and should show you some basic information. It will say “Bash,” your username, and the Terminal window’s dimensions. You can resize the window as you would any other.
Terminal has several neat features that make it slightly easier to use than other command-line interfaces. If you open up several Terminal windows, they’ll be given different background colors to tell them apart. You can also add bookmarks as you navigate, to make the whole process easier.
How to Navigate in Terminal
If you’ve never used a command-line interface before, it can be a little baffling. In this short section, we’re going to tell you how to navigate your way through Terminal’s mysteries.
The text on the left of the blinking prompt tells you what file directory you are currently in. Type in the command “ls” without the quotations, and you’ll see a list of files in the current directory.
You don’t want to be restricted to one file directory. To change directory, type in “cd” followed by the name of the folder we want to go to. Using the terminal is easier than you thought, right?
Now that you know the basics of navigation, it’s time to learn about parameters. These change the way a command is processed. For example, if you want to list all files in a directory, including hidden files, add “-a” after “ls.”
To open a file in a directory, guess what you type? “Open” followed by the name of the file. It will autocomplete once you’ve typed in the first few letters of the file, which is a nifty feature.
If you want to go up a level in the file system, simply type “cd” with no other arguments or parameters.
Now that you know how to open Terminal on Mac and the basics of navigation, let’s look at some of the essential Terminal commands that you need to know.
- How to Create and Open a File in Terminal
Let’s say that you want to quickly create a file from within the terminal. The command that you need to know to create files is the “touch” command.
If you want to create a file that has multiple words in its name, you need to be quite specific. For example, let’s say I was creating the file for this article in Terminal: if I typed “touch how to open Terminal on Mac and commands you need to know.txt,” I’d get 13 different files. Every word would get its own text file.
To create this article, I’d need to include the title in quotations. So the command would be “touch “how to open Terminal on Mac and commands you need to know.txt”.”
Remember that the file will be created in whichever directory you are currently in. If you want it to be elsewhere, you’ll have to use “cd” to get there first.
To open the file from Terminal, you’ll need to know what software you’re going to use to open it. Type “open -a /applications/program.app” then the file path of the file you want to open. Remember to replace “program.app” with the program’s name.
- How to Create a Folder on Mac in Terminal
Making a folder is, if anything, even easier than creating a file from within Terminal. Use “cd” to get to the directory you want to create your new folder in.
Let’s say that you want to make a folder called “Work.” Then all you have to type is “mkdir “work”.” Like with other commands, this one has a fairly obvious root to remember it by: “mkdir” is shorthand for “make directory.”
- How to Copy Files
We all know how important the copy and paste commands are. Keeping copies of your work and backups is hugely important.
Making a copy of a file is easy. Let’s say that I want to make a copy of this article and put it somewhere else on my Mac. The command I need here is “cp” for copy.
I should follow the name of the file with the directory that I want to copy it to. So I could type “cp “how to open Terminal on Mac and commands you need to know.txt” /Users/Username/Documents/.” Voila, a copy is made!
- How to Delete Files
Now that we’ve made a copy of this article in documents, let’s delete the original.
To delete a file, you need to use the command “rm,” short for remove. To remove the original file, simply type “rm “how to open Terminal on Mac and commands you need to know.txt”.”
If you’d like a little extra security, add the parameter “-i” after “rm.” Terminal will then ask you to confirm the deletion.
- How to Find the Filepath for Your Directory
As you’ve seen, a lot of commands in the Mac Terminal require you to know the full file path of a target directory. It can be quite hard to remember this string of arcane names without some help.
Luckily, there’s a command to help you out. At any time, you can type “pwd” to be given the full file path of your current directory. If you need to do anything in this folder, you now know what to type.
- How to Get Some Help
There is a huge range of commands available in the Terminal. If you need a little bit of extra help, there’s a command baked into the program to help you out.
Type the command “man,” short for manual, followed by any other command. Terminal will then open up the Unix manual of that command for you. It will tell you what the command does when it should be used, and tips on using it effectively.
- How to Execute Commands as Administrator
Some commands require you to have administrative privileges before they can be executed. It should go without saying, but you should only ever execute these commands if you know exactly what you are doing. Doing the wrong thing with admin privileges is a good way to mess up your system.
The command to execute a command with admin privileges is “sudo.” This is shorthand for “superuser do,” and allows you to execute almost any command. This Xkcd strip shows its power pretty accurately.
To use “sudo,” simply type it in, followed by the command you want to execute. You will be prompted to type in your password. Do this, and the command will run.
- Downloading Files From the Internet with Terminal
We’ve shown you the power of Terminal relating to files on your computer, but you can also use it to download files from the internet. Presuming you know the URL of the file, it can be far quicker than navigating to it in a web browser.
Go to your downloads file by typing in “cd /downloads/.” Then use the command “curl -O” followed by the URL of the file.
If you’d rather download it to another folder, then simply “cd” your way to the target folder before using the command.
Enjoy the Power of Terminal
Now that you know how to open Terminal on Mac, you can enjoy a whole other level of computing power. Command-line interfaces give you far more flexibility than the normal, restrictive UI. Just remember to research commands before you use them, and only execute with admin privileges if you know what you’re doing!
Want to learn more awesome Mac skills? Take a look at the Mac section of our blog!