How To Use Terminal On Mac

This built-in app can get many tasks done A diverse suite of Apple apps welcome you when you first set up a new Mac. If you are a programmer, developer, … Read more

Taylor Bell

Taylor Bell

Published on May 06, 2024

How To Use Terminal On Mac

This built-in app can get many tasks done

Terminal app window on a MacBook Air M2

A diverse suite of Apple apps welcome you when you first set up a new Mac. If you are a programmer, developer, or a power user, you may find the Terminal app useful in your workflow. If you are new to Terminal commands, you may find it confusing at first glance, which is totally fine since it is mostly for advanced users and workflows rather than casual ones. But if you are curious to know more, continue reading to learn everything about the default Terminal app on Mac.

MacBook Air running Terminal commands

Related

How to add Python to PATH in macOS

Save time by streamlining your Python development setup in macOS.

What’s Terminal?

Two Mac desktop screens on a MacBook Air and Apple TV.

Terminal is an interface that revolves around command lines. So, when using Terminal, your interaction will typically revolve around typing commands and waiting for the system to execute them. The good news is that an internet search will typically guide you through what command to type into the Terminal to achieve your desired effect. These commands could control apps, files, system functionalities, and more. Notably, the tasks in Terminal run without a graphical user interface (GUI), and the app generally reacts by displaying textual feedback.

How to launch Terminal on Mac

macOS Terminal and Apple logos side by side

There are several ways to locate and launch Terminal on Mac. You can simply press the Command + Space keys to open Spotlight Search, type Terminal, and hit the return key to open it. You can also find the Terminal app from the Mac Launchpad or the Finder> Applications menu.

Terminal Profiles

Before we get to the commonly used Terminal commands, you may want to take a look at Terminal Profiles.

  1. Launch the Terminal app on your Mac.
    new terminal window on macOS

  2. Hit the Terminal button in the menu bar, then choose Settings.
    terminal settings button in menu bar

  3. Go to the Profiles tab. There, you will find several presets in the sidebar, each having its own unique colors and characteristics.
    list of profiles in the sidebar of terminal settings

  4. You can double-click on a profile to open a new Terminal window with the profile (with its colors) applied.
    green terminal window on macOS

  5. For each Profile, you will find multiple tabs, including Text, Window, Tab, Shelland more. These allow you to tweak some of the more advanced specifications of a Terminal window. If you’re not sure what you’re doing, leave them as-is.
    profile options in terminal settings

A sideview of a MacBook Pro showing the Terminal app running a traceroute.

Let’s move on to the primary functionality of Terminal on macOS, which is running command lines. Naturally, we can’t list all the compatible commands, as Terminal basically supports an infinite number of them. The app can run commands revolving around both first-party and third-party software, which means the possibilities are endless. To find certain commands that cater to your specific use case, you can simply look them up on the web. Nonetheless, we will be listing some of the most popular ones below. Paste any of them into a Terminal window and hit the Return button to run them (which is a critical step to take in order to initiate the command).

Before we start, make sure to type commands in Terminal without any typos. Every character, including spaces, matters in Terminal. Also be mindful of upper and lower case, since the case also matters in Terminal commands. Furthermore, keep in mind that you can’t use a mouse or trackpad in Terminal, you will be navigating the interface using the arrow keys only.

  • To ping a certain website’s server: type ping google.comwhere you can replace the google.com text with the actual URL you’re seeking. If you get an error, then the website is likely down or inaccessible.
  • If you’ve installed Pip on your Mac, you can download packages from PyPI: pip install package_name. Replace the package_name portion of the command according to your intention.
  • To get a comprehensive log of your system and its installed apps: system_profiler.
  • To view a list of running processes: ps to.
  • To kill a running process: kill process_id. Replace process_id according to your needs.
  • To navigate to your Home folder: cd ~/Documents.
  • To view a list of files in a certain folder: ls.
  • To move files from one folder to another: ditto folder_1 folder_2. Replace folder_1 and folder_2 accordingly. The former would be the source folder, while the latter is the intended destination.
  • After navigating to a certain folder using the cd command, you can download files from the web to it: curl -O URL. Replace URL with the direct download link of the file.
  • To change the default folder where screenshots are saved: defaults write com.apple.screencapture location new_location and press the return key. Now, type killall SystemUIServer and hit return to apply the changes. Similarly, you will have to replace new_location with the actual place where you want screenshots to save.
  • To change the default screenshot format from PNG to JPG: defaults write com.apple.screencapture type JPGpress the return button, then type killall SystemUIServer and press return to apply changes.

As you can see, there are all sorts of different commands that revolve around certain apps or functionalities. You can easily look up the ones online that you may need, based on what functionality you’re looking for. You could also rely on some AI tools, such as ChatGPT, in order to find the right command for an action you’re seeking. Do keep in mind that Terminal works in a very specific way though. So typos or other inaccuracies in capitalization or spacing will likely result in errors. And, for example, when prompted to answer with yes or noyou should typically just type Y or N. The more you use Terminal on your Mac, the more you’ll start to grasp the logic behind it and understand the way it operates.

Terminal mostly caters to advanced workflows

As our guide reflects, Terminal is a very complex and capable app that can execute all sorts of different actions. However, most of the basic commands can be done using more familiar methods. For example, you can download a file using Safari instead of relying on the curl command, or use Finder to move files from one folder to another instead of taking the Terminal route for this simple task. Nonetheless, it still offers plenty of exclusive commands that you may not be able to execute using another app, but these tend to revolve around advanced workflows, rather than everyday tasks such as renaming a file.

If you are new to Apple’s desktop operating system, check our dedicated guide to learn the first things you need to do with a new Mac.

Partager cet article

Inscrivez-vous à notre newsletter