Type to search

Guidelines To Use The Terminal Command Line In MacOS

If you are a Mac user, you would know this Operating System is designed with a window-and-icon interface. Only through the Terminal command line, you can access a Mac-based system. 

It is a default gateway that turns on hidden settings and troubleshoots many issues on your Mac. Mainly you can interact with your Mac through this command line.

So, if you are not familiar with the Terminal command line or a beginner with a Mac device, you have clicked on the right link. Here, we are going to discuss the best ways to use the Terminal command line in macOS.

About Terminal

The Terminal app is found in the OS X’s bash shell. Once it opens, you will find a white text screen. You have to log in with your OS X user account by default. Just use a system having an Administrator account and get direct access to almost all your computer’s software code.

But, while you are using the Terminal for executing commands, understand the concept first and then type the command line. The best part is that through Terminal, you can get secure connections for other machines, and web servers. With this application, you can even build your scripts on Mac OS.

Tips for Using Terminal Command

Before you use the Terminal command line, you must be aware of the basic facts. Let’s look at the facts that are described below.

General Syntax

Usually, a bash command follows a basic pattern-

[Command] [Options] [Input or Path to File or Directory]

For example, ls -la /Applications

Here, “ls” is the command, “-la” is a compound of two individual options (-l and -a), and “/Applications” is the path to list.


For getting direct access to the files, you can use Terminal. But, you would not require to create any “Finder” for that. Hence, only by creating a path you can easily get access. In many ways, path’s appearances are similar to the website’s sub-directories. Sometimes, the structure of your folders can be followed by these paths.

Generally, you can find paths in two forms- Absolute paths and relative paths. The absolute path begins at the root level of your hard drive. Such paths are displayed as  “/”. So for making an Application folder path, you have to write “/Applications/”.

When you have already navigated to a particular folder, you can define that through relative paths and with “/” sign. For example, if you are in the “/Applications/” folder and your current working directory is (CWD). 

Note: By typing “/Utilities/”, you can get your ‘Utilities’ folder. Here, you do not need to type “/Applications/Utilities” to access the folder.  

White Space

For using the Terminal process properly, avoid white space. Using a space means the end of a command. So, if any of your folders have spaces in between its name, it can indicate the end of execution.

Take an example with the “Path Test”. So while listing its content with “ls /Applications/Path Test”,  then bash won’t identify your folder and you will find a message.

So it’s better that you write the name in quotes. Otherwise, use the backslash while using the Terminal command line in Mac.


For using the Terminal commands, you would require Administrative-level access. So, for getting Administrative-level privileges, you can type “sudo” in front of your command. However, if you are not logged in to your account but, have the Administrator’s password, you can follow this step.

Steps to Follow to Open the Command Line

For using the Terminal command line, you must know how and where to find it. Hence, you can find the Terminal app in the “Utilities” folder in the Applications.

  • So, Open the Applications folder>Utilities folder>Terminal application.


  • Use Spotlight search in OS X and locate Terminal. Then select it from the search result by double-clicking on it.

Use Terminal Command For Increasing Workflow

Let’s discuss some handy Terminal commands that can improve your workflow. Type man<command name> into the Terminal and you will be able to pull up full information on these commands.

Use ‘find’ Instead of Spotlight

Bash’s find command is a faster searching tool and can search for any kind of system folders. The command ‘find’ has four parts in its syntax.

  • find 
  • /Applications (the path of the directory you are looking for)
  • -name (Options)
  • The string you want to search (for eg. Google Chrome)

Type Du and Replace Cmd+I

By using this command you can see multiple folders at one time. Its benefit is that it loads faster as compared to the “Cmd+I” command. 

The full form of ‘du’ is disk usage. Through this, you can get the estimated size of a file or folder quickly. This command can show you the list of files within a folder.

Options that you can use for this ‘du’ are described below.

  • -d(depth): This option is followed by a number. So, when you run du -d 1 /Applications, you can see only the total size of the folders and files in the Applications folder. Here, you can’t view the size of the subfolders.
  • -h(human-readable): With this, you can see the size of your files in K (Kilo), M (Mega) or GB (Gigabytes). 

Use ‘mv’

This command is for faster movement of files and folders. You do not have to follow any particular navigation while utilizing this Terminal command. Just use this command to move a file from one folder to another. For this, you just have to change the name of the path like 

“mv<old file path><new file path>”.


Like ‘du’ command, this command helps you to get information on multiple files at one time. Through this robust folder, you can see the exact information that is present in your folder.

You can also see who can see this information. This is the best command that shows all your hidden folders and files. Now, check out the below options for using this command.

-I (long):  Through this command, you can get the permissions for viewing every file in the folder. Besides, you can also find the current modification time, the name of the file owner and file name.

-a (all)- Use this command and you can see the hidden files in a folder.


By using this command, you will be able to set the name right in the command. This quick command allows you to create new folders instantly. 


This command is usually used for deleting the files. Simply use this command and it will delete any file that presents in its path. While using this command, you need to use it carefully, as it will not ask for your confirmation. 

Another thing you must remember is that you can delete only files but, not the folders. Hence, if you want to delete folders, you may use -R option that refers to recursive.

Rules of Terminal

When you will use this command, you have to remember the following rules.

1. Remember to use the right case of the character and give spaces properly.

2. For using this Terminal command, you have to use arrow keys.

3. Use the Up-arrow key to re-run a command and then press “Return”.

4. Type Control-C to interrupt a running command.

5. Always remember to specify a current location in the command so that it will run in the right place. 

Note: Go to the Finder>file or folder that you want>drag it to the Terminal window., place the cursor at the point where you have typed the path.

Create a New Folder

For creating a new folder in the Documents directory, follow these steps.

  • Open a Finder window and go to the Documents folder.
  • Type “cd” and drag the Documents folder onto the Terminal window.
  • Enter mkdir “TerminalTest”. Then return to the Finder and open “Text Edit”.
  • Build a new file “TerminalTestFile.rtf” and save it to the “TerminalTest” in your Documents folder. 
  • Type “cd ~/Documents/TerminalTest” in the Terminal window then select “Return”.

Now type “ls” and you will see “TerminalTestFile” listed.

Change the Name

If you want to change a file name, then type the following steps and press “Return” after every step.

  • cd~/Documents/TerminalTest
  • mv TerminalTestFile TerminalTestFile2.rtf

Few Advanced Terminal Commands

Apart from the above-mentioned commands, there are some other Terminal commands available for different tasks. Some can be used in Terminal and Finder. Whereas, there are some that cannot be accessed from the “Finder”. Go through the below-mentioned examples to learn them.

  • To copy files from one folder to another, type-ditto [folder 1] [folder 1].
  • To see the copied files in the Terminal window, type “-v” after the command.

For downloading files from the Internet, get the URL of the file that you want to download and type-

  • cd ~/Downloads/
  • curl -O [URL of the file you want to download]

So, always use the Terminal command line carefully, as this tool has deep access to your Mac’s system files.