Just how we have the Command Prompt application on Windows, macOS has a Terminal that we can use for executing commands or to make changes in the OS. The terminal is a macOS dedicated Command-Line application that you can use for making changes in system settings, open files or apps, or accomplishing tasks. Developed by Apple, the Terminal comes pre-loaded as a default macOS app along with each update. You can find the Terminal app in Mac’s Utility folder.
So, Terminal is the command prompt on Mac. Wondering how to access the Command Line on a Mac. We’ve got you covered. Let’s quickly learn all about Mac’s Terminal app, how to open this app and how to execute basic commands using the command line.
Why is the Terminal Useful? How to Access it?
The Terminal command line allows you to quickly take over the operating system. Each window in the Terminal represents a Shell process. To open the Terminal app, you can either make a quick Spotlight search to launch the command prompt on Mac. An alternative way to open the Terminal is by navigating to Finder> Applications> Utility folder on your macOS. Find the Terminal app and then double-tap on it to launch it.
Also read: How To Customize Default Shell On Terminal?
As soon as you launch the Terminal app on your Mac, the prompt window will display your user name with which you’re logged in, the device name, current folder followed by a prompt symbol.
So, in this scenario, Michael is the user account’s name, MacBook Pro is the device and the current folder location is the Home folder.
How to Use the Terminal Command-Line in macOS
New to the command prompt on Mac? Don’t worry! Let’s get started with the basics first.
To open any application using Mac’s Terminal, here’s what you need to do.
Open -a SPOTIFY
The command is followed by the application’s name. You can replace it with any other app as well as per your preference. In our example, we have framed a command to open the Spotify app on macOS using Terminal. After typing the command, press the Return key to execute the command.
Open Folders Using Mac’s Terminal
You can also use Command Prompt on Mac to open any folder and to view all the files that are included in it.
Type cd~/documents and then hit Enter to open the Documents folder.
Now type “Ls” and hit Enter to see the list of files.
As soon as you hit the Return key, you will see the list of all the files that are placed in your Mac’s Documents folder.
Move a File or Folder Locally
To move any file or folder locally using Terminal, you can use the mv command for getting the job done. The mv command is used for changing the location of a folder and moving it to a new location. Here’s how you can use it on macOS Terminal:
% mv ~/Downloads/MyProjectFile.txt ~/Documents/MyProjectFile.txt
Let’s understand how this command will work so that you can have a better understanding of Command Prompt on Mac.
In our example, we have moved the MyProjectFile.txt file from the Downloads folder to the Documents folder.
Also, if you need to move a file to a subfolder, then you can write as:
% mv ~/Downloads/MyProjectFile.txt ~/Documents/Work/MyProjectFile.txt
“Work” is a sub-folder in the Documents. Hence, now the MyProjectFile.text will be moved to the Work folder directly.
Use the Built-in Manual on Terminal
Confused about how a particular command works on Terminal? Well, you can also take the help of the Terminal’s built-in manual to learn about any command, the syntax, how it works, etc.
To do so, simply type man [Name of the command]
For example, if you want to learn more about the “Move” command, you can simply use the following command:
Press the Return key to know all about the “Move” command.
Here was a quick guide on how to use the command prompt on Mac. The terminal can be used to take control of the OS and to accomplish almost anything on macOS. Command Line Terminal helps you access the deep-rooted folders and drives that you cannot navigate via Finder. Hence, launch the Terminal as the quickest way to learn it is by shooting a few commands.
For any other queries or assistance, feel free to use the comments space!