How to Use the Terminal Command-Line in macOS

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.

Use the Terminal Command-Line

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.

Also read: How To Enable Hidden Features Using Terminal On Mac?

Why is the Terminal Useful? How to Access it?

Why is the Terminal Useful

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?

Understanding 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.

michael@MacBook-Pro ~ %

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.

Also read: Steps To Customise Your Mac Terminal & Increase Productivity

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.

Basic Commands on Terminal

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.

Open Folders Using Mac’s Terminal

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.

Also read: Mac Terminal Commands Cheat Sheet Everyone Should Have

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.

Use the Built-in Manual on Terminal

To do so, simply type man

For example, if you want to learn more about the “Move” command, you can simply use the following command:

Man mv

Press the Return key to know all about the “Move” command.

Conclusion

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!

Leave a Reply

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

Subscribe Now & Never Miss The Latest Tech Updates!

Enter your e-mail address and click the Subscribe button to receive great content and coupon codes for amazing discounts.

Don't Miss Out. Complete the subscription Now.