Run the terminal on the Mac OS. Create a Terminal Shortcut

Fundamentals of navigation

CD team. One of the main teams that allow you to navigate in various directors. If, by opening the terminal, you immediately want to be in a specific directory, say, in Documents, it is enough to dial in the CD Document terminal.

CD ~ team with which you go to your directory. For example, if you decide to go to the directory where your documents are located, then the next command will look like this: CD ~/doCuments.

CD. allows you to return to the previous directory.

CD. allows you to go up to a higher directory.

LS issues a list of file names in the specified directory

LS.F shows files with their extension.

LS.a lists all files, including hidden.

LS.LO, in addition to listing existing files, also shows their access rights and the date of their creation. If you want only files starting with a certain letter, for example, with Z, dial LS Z. Keep in mind that the team is sensitive to the register, and if some files have a title Z at the beginning, and you scored ordinary Z, you simply will not see them.

Mkdir creates a new directory. For example: by typing the command: Mkdir New, you will create a new directory with the name New.

Rmdir New. Removes a directory named New.

If you want to delete a directory that is not empty, you either must at the beginning delete all its contents or use the RM command.R

Rm.R New: deleys the New Directory with all its contents.

Clear. Cleans the terminal screen. In principle, sometimes it’s enough to make a “” on the terminal window and choose in the context menu. Clear scrollback.

script. allows you to save all the symbols you enter into the text file from the keyboard. On practice. An extremely convenient option that allows you to get a complete protocol of your entire session. The file will also indicate its exact date and time.

The file will be saved with the name Typescript in your home directory.

BC. a team that will display the simplest console calculator on the terminal screen.

DF. A simple team that will show you the volume of your disk space, including network discs.

Du. List of all folders available on your system section.


Copying files and folders is carried out using the CP command. Suppose you want to copy the Note file.TXT from the desktop to the Documents directory. In this case, you will need to type in the CP Note terminal.TXT ~/doCuments

It must be borne in mind that if a file with the same name exists in a new place, it will be deleted and replaced by a copied file without warning and the possibility of recovery.

If at the same time you want to not just copy the file, but copy and save it already with a new name (for example, we take the new name for New.txt), the required command will look as follows. CP Note.txt ~/doCuments/news.TXT. And your file will appear in your folder.txt, which is a copy of the Note file.TXT from the desktop.

In order to copy the desired file to the source catalog, but with a new name, it will be enough to dial CP NOTE.Txt New.TXT

CP.R doocements “Documents Backup”. A team through which you save a backup of your entire Documents Directory. Quotation marks are necessary, since the name of the directory has a gap.

Sudo CP.RP /users ” /users backup”. The team allows you to copy the entire directory /users (including all home folders inside), while maintaining as much file information as possible (affiliation, rights, etc.D., but not a branch of the resource) with the name Users Backup. You must execute this command from the administrator’s account, so this example uses SUDO, which allows you to get temporary access with ROOT rights. If you execute a command from the user account, you will be asked to enter the administrator password.

Ditto allows you to copy the directory, but while maintaining attributes of hidden files.

Ditto Documents “Documents Backup” copies the entire directory under the name “Documents” and calls a copy of the Documents Backup directory.

MV. Renaming files. For example, by typing MV New Old in the terminal, you will rename the file or directory with the name of News in OLD. And the next command: MV Old ~/Documents. You will move it from the current directory to your Documents Directory.

Open Terminal Using Spotlight Search

One of the Quickest and Easiest Ways to Open Terminal On Mac is with Spotlight Search:

1) IF YOU HAVE The Spotlight Search Button in Your Menu Bar, Click It. Otherwise, You Can Use The Keyboard Shortcut Command Space.

3) You Shoup See the Terminal Application Under Top At the Top of Your Results. Double-Click It and Terminal Will Open.

Open Terminal Using Finder

Open Finder Or Make Sure that Your Menu Bar Ising Finder and Not Another Application:

1) Click Go Utilites from the Menu Bar.

2) In the Utilities Folder that Opens, Double-Click Terminal.

Window navigation and tabs

Scrolling to the very top: ⌘cmd home (fn arrow to the left)

Scrolling to the very bottom: ⌘cmd end (fn arrow to the right)

Steping upward upward: ⌘cmd page up (fn uphole)

Strailing on the page down: ⌘cmd page download (fn down arrow)

Stick up on the line up: ⌥option (ALT) ⌘CMD PAGE UP

Stick on the line down: ⌥option (alt) ⌘cmd page download

Working with command line

This tool allows you to work with the command line even easier than with labels.

New command: ⇧shift ⌘cmd n

Move the insertion point: ⌥option (ALT) Cursor key

Move the point of the insert to the beginning of the line: Control A

Move the cursor to the end of the line: Control E

Move the cursor forward: the cursor arrow to the right

Move the cursor back: the cursor arrow to the left

Move the cursor to one word forward: ⌥option (alt) arrow to the right

Move the cursor back to one word: ⌥option (alt) arrow to the left

Remove everything to the start of the line: Control U

Remove everything to the end of the line: Control k

Delete the symbol to the right of the cursor: Fn Delete

Delete one word to the right of the cursor: ⌥option (Alt) D

Delete one word to the left of the cursor: Control W

Go to the terminal on the Mac through the program with programs in Finder

It is also used less often due to a larger amount of time required to open. Open Finder. To do this, click on its icon in the lower dock menu.

Turn your gaze to the left menu. The terminal application is located in the “Program” section in the “utility” folder of your computer Mac. To open it first, click on the menu tab with programs, then go to the folder with utilities. and already there find the terminal itself.

Agree, a lot of extra actions? And which of the ways to launch Terminal use you? Share with us in the Комментарии и мнения владельцев under this article.

How to see a description of any terminal command on Mac (MacOS)

You will see a vast list of teams. Some of them may be familiar with advanced users, and even professional users may not know about some. You can find out the purpose of a particular command in the following way: on any command from the list.

In the displayed menu, select Open the MAN page.

After clicking on the specified option, a new window with the instructions will open.

Access to the terminal from Finder and Launchpad

The most logical way to gain access to the terminal. via Finder or Launchpad. To gain access from Finder, you just need to click on the upper Finder menu on the file New Finder (⌘n) window and then find the “Appendix” item on the left side panel, click and look for the folder of the terminal between the applications that are displayed on the right side of the window.

If you want to access through Lauchpad, we must click on the rocket icon in the dock folder other terminal

Open the terminal from Spotlight

The third way to get into the terminal window. through the SpotLight universal search engine, to which we can call instantly by clicking the magnifying glass on the top panel to the right of Finder. When pressing a magnifying glass, we are asked to write what we want to find and just gaining time. The application seems to be clicking on it and open it.

What is a terminal?

Mac has its own command line integration, in which you can easily and quickly control the tasks and manage them than to perform an ordinary and long process. Nevertheless, its integration looks frightening, especially if you have no technical knowledge or ideas. But if you want to look at this useful application, you will probably like it earlier!

Who knows? You can be interested and learn more tricks on how to move around the terminal.

How to open a terminal on Mac

The terminal application is not so difficult and difficult to find in Mac. Here are different steps on How to open a terminal on Mac If you need.

Through a folder of applications

Another way to open a terminal. take advantage of the search for Spotlight and enter the word “terminal”, and as soon as you see it among the displayed results, click the terminal application icon.

After you have successfully opened the terminal, you will see a small window with a white background on the desktop, you can see your user name and the word “Bash” or also known as Bourne AGain Shell, including the size of the window. You can easily configure the window, increasing it, dragging the right lower corner outside.

Mac Bash. This is the one that is used in the terminal among many different shells performed by UNIX commands. You can configure the size of the window as you wish.

MV team

MV. Poppers as “move”, which translates as “move”, “move”. With the help of this command, we can:

So, in order to move files from one folder to another, we write the following:

For example, let’s move the Image file.JPG from the NewDirectory folder to the desktop (T.e. to the level above). For this, we write:

MV Image.JPG/users/Maria/Desktop

As you can see, we indicated the absolute path. That is, this is not relative to our current folder (“relative” path), but the path along which the folder is in the system. This can be compared with the address. We can say that the house is “on a neighboring street” (it will be a relative path), but it is possible that it is at the address. For example, st. Street 123 (this will be an absolute path).

How to run Terminal commands from a script on macOS

Thus, our file move to the desktop:

As you can see, now there is no image in the folder. Instead, it is on the desktop:

Let’s now return the file back. Let’s write:

As you can see, we take Image file.JPG, which is located higher (./Image.jpg), and we overtake it into the folder in which we are now (.).

Now, Image file.JPG again in the NewDirectory folder:

In addition, we can move several files at the same time. Syntax is this:

So, let’s move all the files from the NewDirectory folder to the desktop. And this time, we use not the absolute path, but relative. We write the following:

MV Image.JPG 1.TXT 2.TXT 3.TXT./.

where does all files in the folder mean.

Now we can see that all the files we indicated have moved to the desktop:

Now, let’s see how you can rename the file. Syntax is this:

For example, let’s change the name of the file with Image.JPG on Picture.JPG. To do this, we need to go to the desktop folder using the CD command, and then write:

If we now open the desktop folder, we will see the following:

Excellent! Now the file is called differently. Picture.JPG.

That’s all. Now you know the main teams for working with the command line on Mac OS.

We hope that our article was useful to you. You can sign up for us for java courses on the site.

General commands for Mac

The main syntax

[Team] [Options] [Entering or the path to the file or directory]

LS is a is a connection of two options (-l and.a), a /applications is the path to the list.

If you understand the path, you will understand how MacOS actually sees your files. How? Yes, like in a nesting doll. one after another. For example, here is the path to the file called “My Secrets” lying on the desktop:/users/yablykworld/desktop/my secrets.


There is a simple rule with spaces. nothing superfluous!

Why? The fact is that Bash considers the gap to the end of the team!

If you have a folder with spaces in the name. for example, Yablyk Folder, and you are trying to derive its contents using the LS /Applications /Yablyk Folder command, the corresponding file will not be found, and an error will appear at the exit:

To solve this problem, you will need quotes or a reverse slash. Now everything will be correct:

LS /Applications /”Yablyk Folder”. or ls /applications /yablyk \ folder

Many teams need access to administrator level. If you are now using the Mac not under the Admin account, but you know the password, enter the command line in front of the text of the SUDO team itself. (which means “Single User Do”, “does one user”). So you will temporarily receive the privileges of the administrator and the ability to perform the necessary operations without changing the account.

Terminal commands to improve productivity

Find syntax consists of four parts:

the path to the directory in which you want to look for information (for example, /Applications);

options (for example.Name gives found the ability to look for files that are suitable for a given name);

Directly search query itself (for example, Google Chrome).

Find /Applications.D 1.Name “Google Chrome”

Note: “Asterles” indicate that regex is used (regular expressions).

  • Replaces: ⌘cmd i, t.e. commands to display information;
  • Why is it better: it can show several folders at a time at a time, and is usually performed faster.

Du is a reduction from Disk Usage. The team will help quickly find out the size of a particular file or folder, or even a list of files inside the folder.

-D (“depth”, or Depth): If the figure is behind this letter, then Find will limit the search for the Directory with the corresponding number of levels. For example, if you give your MAC command Du:

The terminal will give you information only about the general “weight” of folders and files in the Applications folder, without data on the size of the subacages invested in these folders.

-H (Human Readable, or “Human-Readed”). Displays file dimensions in values ​​familiar to people. k (kilobytes), m (megabytes) or G (gigabytes).

  • Replaces: manual transfer of folders and files to the right place.
  • Why better: faster and does not require a lot of manual labor.

MV syntax is very simple. the old way changes to the new one:


This command transfers File1 from the folder to the desktop.

  • Replaces: ⌘cmd i (show information).
  • Why better: faster, knows how to display information about several files at once and has a rich settings palette.

LS. incredibly powerful. a team to display what is in your folders. She also gives information about who has the right to see them, whether there are hidden files or folders on your Mac, and much more.

-l. displays the rights for each file in the folder, the time of the last change, the owner of the file and its (file) name.

-A. shows all the files in the folder, including hidden (a great option for the user library, which is hidden in MacOS by default).

Linux/Mac Terminal Tutorial: Creating Aliases for Commands


  • Replaces action: finder → File → New folder.
  • Why is it better: it works faster, and you can set the name with a new daddy immediately on the command line (there is no need to click twice, as it takes place in a graphic integration).
  • Replaces: the procedure for sending files to the basket and its cleaning;
  • Why is it better: faster, plus even those files are deleted from which it is usually not possible to get rid of a basket.

This team once and for all delements absolutely any file that you will put in the command. Which, of course, requires increased attention. unlike the basket, RM will not ask “but you are sure?””. It is assumed that you know what you are doing.

By default, RM deleys only files, folders remain. In order to immediately delete them, use the.r option (recursively).