How to Use Terminal on Mac

You’ve probably seen it on your Mac’s desktop. Maybe you’re a little unsure of what it is or what it is for. Or perhaps you know what it is, but you don’t know how to use it. Either way, if you’re looking to find out more about Terminal, you have come to the right place.

Mac’s Terminal application is a very powerful tool, and if you are just learning about it, you will first want to find out what it is, how to use it, and the benefits of using it. I will also cover some of the questions new Terminal users have

My name is Eric, and as a software engineer, I use terminal applications such as Mac Terminal daily. Here I will do a quick overview of the Terminal application to provide new users with information that can help them feel a little more comfortable.

Keep reading if you would like to hear about how you can use Terminal on Mac.

What is Terminal?

If you’re not familiar with the Terminal application on Mac, no worries, we will do a quick overview here. It’s not a tool that everyone uses, so most Mac users may not really know what it is for.

Used mostly by software developers, engineers, testers, computer enthusiasts, and many other technical users, the Terminal application is an interface that lets you send commands directly to your Mac’s operating system. It’s also known as a command-line interface.

These commands are typed in, usually one line at a time, as ASCII characters interpreted by what is called a shell. By default, the Terminal application uses BASH, which is a LINUX/UNIX-based shell, but it also comes with a few others that are very similar.

The shell allows us to type in commands that we understand, and it translates them to lower-level system commands that macOS and your computer can understand. 

The Terminal application basically uses typed commands to do everything. There is no mouse-clicking, dragging and dropping, or other types of actions you would typically take from your desktop.

The Terminal app takes many of us older computer users back to a time when graphical user interfaces (GUI) were very rare, and most of us did our work from the command line. In fact, Terminal is based on the original command-line interface that Apple used in its first computers.

How to Use Terminal

Now that you know what Terminal is, you probably want to know how to use it. You use the application by starting it up and typing in specific commands that will perform different tasks that you wish to do, or that may only be available from the command-line interface.

Unlike performing tasks from your desktop GUI, where you click on buttons and links and enter information into text boxes, Terminal often requires that you type in multiple commands to accomplish something. That being said, many simple commands can also be run.

This interface can seem scary and even like a foreign language for beginners. That’s because shell commands and scripts really are a language that you use to direct the computer to do something.

Just like learning a foreign language, it can take some time. The more you learn and use it, the more comfortable you become with communicating in that language. After you have used it fluently for a while, it becomes second nature, and you don’t really think about it.

You may be asking why even take the time to learn this new interface and language. The answer is that using a tool like Terminal to interface with your computer at the command-line level gives you the power to take control of your operating system.

Simply put, you can do things with Terminal that you can’t easily do from your desktop GUI. There is no need to open up Finder, System Preferences, or any other app. You just type in the commands. There’s no way I can list all the things you can do but below are some examples.

  • Copy files
  • Rename files
  • Search for files
  • Search for text inside files
  • Delete files
  • Create files
  • Block websites
  • Configure a personal login message
  • Explore your file system
  • Create automated scripts
  • Change configuration parameters of your macOS
  • Change permissions to files
  • Set the time
  • Set the time zone
  • Turn off sleep settings
  • Get your computer to talk

The Benefits of Using Terminal

As you have seen, Terminal is a very useful application, and there are many benefits to using it. Once you become comfortable with it, you will begin to see many of them, and it just may become your first choice for doing many tasks on your Mac.

Let’s take a look at some of the common benefits.

Speed

No more searching for things in System Preferences or Finder. You can quickly locate what you are looking for, run the commands you need to run, and complete tasks quickly and easily.

Available Commands

You have hundreds of commands available at your fingertips—no need to search for or download specific applications. Most of what you need is there and ready to use.

Command Options

Did you know that many of the simple tasks you do from your GUI, such as deleting or copying files, actually have many options available to them when using the command line in Terminal? For example, you can use 12 different options or parameters when copying a file.

See the Output

For most of the commands you run in Terminal, you will be able to see the output or results of the command right there on the screen, not just a pop window that flashes by.

History 

The scrolling input and output of the Terminal application gives you the ability to see a complete history of all the commands you enter and the output from each command. The history command also shows you all the commands you have typed.

This history buffer provides a way to quickly repeat commands that need to be run more than once and adds to the speed of using Terminal.

Access

Terminal gives you access to your entire file system. You can see hidden files and folders and access parts of your system that you wouldn’t even know are there from the desktop.

Examples of Mac Terminal Commands

As mentioned before, there are hundreds of commands. Each has multiple options and parameters available. I can’t show you all of them here but below are just a few examples of some commands that can be run in Terminal.

Command: cd <directory or path>

This is one of the most common commands you will use. The letters cd stand for change directory. It is used to change directories or move to a directory on your file system. In the example below you would be moving to a directory called Applications.

Example: cd Applications

Command: ls

This is another common one that you will use frequently. It lists the contents of a directory. If you don’t specify a directory or path, it lists the current directory. As you can see in the example below, we are currently in the Applications directory, so the command lists all the files and directories under the Applications directory.

Example: ls

Command: caffeinate

This handy command will keep your Mac from going to sleep. Adding the -d parameter tells it to specifically keep the display awake.

Example: caffeinate -d

Command: say <Quote that you would like the computer to say>

This is a fun command that gets your mac to speak and say something in a computer-sounding voice.

Example: say “Hello, this is your Terminal speaking”

This is a very small sample of commands that you can use, but there are many more available and very complex things you can do with them. Take a look here if you want to explore more commands and see how many other things you can do.

FAQ

Here are a few common questions that new Terminal users often ask.

What if My Terminal Screen is Frozen After Typing a Command?

If Terminal is not responding and you are unable to type in commands, most likely it has a process running that has not been completed, or it may be running one that will not finish on its own. 

Sometimes you just need to wait until it completes. If you need to stop a process, you can do it by pressing the CONTORL+C keys.

This can happen with many commands, and some will not end on their own, so you will need to use the CONTROL+C key sequence to end them. 

The caffeinate command shown above is an excellent example of this. After typing the command, you will need to stop it when you no longer want your screen to stay awake.

Can I Damage my Operating System with Terminal?

Yes, you can. As Spiderman’s Uncle once said (and numerous others), “with great power comes great responsibility.” You will always want to use caution when running commands you are unfamiliar with. There is one command you can run that can wipe out your entire disk.

With that being said, many commands are passive and do not modify anything, so don’t let this scare you. Just start slow and try to stay aware of what you are doing. Also, keep your system backed up, and you can always reinstall it if ever needed.

Are there Alternatives to Terminal?

Yes, other applications allow you command-line access to Mac’s operating system. I’m not going to list them here, but you can search for Terminal in the AppStore and find many of them.

Conclusion

The Terminal application on Mac has the power to do nearly anything imaginable with your macOS. There are hundreds of commands that you can learn to run quickly and easily from this fantastic command-line interface.

I hope the information I have provided above can help you to start learning how to use Terminal on Mac. As usual, feel free to provide any comments or questions. I would love to hear from you.

Leave a Reply

Your email address will not be published. Required fields are marked *