How To Navigate To A Folder In Mac Os Terminal

Table of contents:

How To Navigate To A Folder In Mac Os Terminal
How To Navigate To A Folder In Mac Os Terminal

Video: How To Navigate To A Folder In Mac Os Terminal

Video: How To Navigate To A Folder In Mac Os Terminal
Video: Linux/Mac Terminal Tutorial: Navigating your Filesystem 2024, December
Anonim

The macOS Terminal application is designed to work at the command line level - the same level as the first personal computers. In order to learn how to flawlessly navigate between disk folders in the "Terminal", you need to acquire a certain skill.

How to navigate to a folder in mac os terminal
How to navigate to a folder in mac os terminal

Symbols

  • A character in bold and enclosed in square brackets [V] - pressing a symbolic key (in this case, the letter V).
  • A string in italics enclosed in square brackets [Enter] - pressing a special key on the Mac keyboard.
  • The comma character between the opposite square brackets [V], [Enter] is just a sequence of actions: first press the V key, then the Enter key.
  • The plus symbol between opposite square brackets [cmd] + [V] means that this key combination must be pressed simultaneously.
  • The text enclosed in means that there should already be a different text here, depending on your conditions.
  • The $ character at the beginning of a line is taken as a prompt by default (you will have to figure out what a command line "prompt" is) and you do not need to enter it!

About the Terminal application

If you have a question about how to navigate between folders in Terminal, most likely you have never worked with Terminal before.

Terminal is a deeper level of work with macOS - you can do a lot of things in it that the graphical interface cannot do. The reasons for this are different: both purely historical, and the absence of the need to overload the graphical interface with rarely performed actions.

There are many ways to open the Terminal. Most reliable: Open "Finder", on the left in "Favorites" open "Applications", find the folder "Utilities" in them, and already in it - "Terminal".

At the same time, switching between folders is just the most frequently used technique when working with the graphical interface of the macOS file system. What could have caused the need to use a minimalist Terminal for these purposes?

Usually, a transition to a folder in the Terminal is required in order to perform some special actions in this folder using the Terminal itself.

Most likely, you have found an instruction on the Internet that helps you solve your problems, and one of the steps in executing the instruction was the proposal to go to the folder, for example, of your project.

The safest way to go

Enter in the invitation:

$ [c], [d], [space], and press Enter.

If you have no experience with the Terminal, below is an algorithm that guarantees the correctness of your actions.

First, we get in the clipboard the path string to the folder to which you need to go in the Terminal.

To do this, open a window in the Finder application with the name of the folder to which you need to go.

Click on the name of this folder with the right mouse button. The context menu associated with that folder will appear.

Now press and hold the [alt] key - some of the context menu items will change, then select the "Copy path to" item. There is one pitfall here: the full path may contain spaces inside, which the Terminal command interpreter will take as a separator character between individual parameters. Therefore, for a guaranteed action, the resulting path will need to be enclosed in quotes.

Now open Terminal, type in the prompt:

$ [c], [d], [space], [″], [cmd] + [V], [″], [Enter]

The name of the folder should appear in the prompt - it means you have gone to the desired folder! (cd is short for Change Directory)

Useful Tips

To view a list of files in a folder, type:

$ [l], [s], [Enter]

The type of information presented can be changed using the parameters. For a more detailed list of all options, see the Internet.

To go to the root (topmost) folder, type:

$ [c], [d], [space], [~], [Enter]

Usually, the transition is carried out not by copying the path from the "Finder", but by sequential transition up / down through the structure of neighboring folders.

To move to a higher level:

$ [c], [d], [space], [.], [.], [Enter]

Immediately up two levels:

$ [c], [d], [space], [.], [.], [/], [.], [.], [Enter]

Accordingly, this scheme ($ cd../..) can be complicated.

Use the up / down arrow keys to bring up recently typed commands to the prompt.

And one more trick: when you decide to type the path manually, going from folder to folder, in order not to type long names, just type the first few characters of the name of the folder to which you want to go and press [Tab]. If such a folder name is uniquely identified, it will appear in the invitation. Moreover, there will be a / at the end, which is the correct use of the "cd" command, although it is allowed to use a folder name without / at the end. If, after pressing [Tab], a name is added to the line, but without the trailing / character, this means that there are several folders in this place, starting in the same way. If you press the [Tab] key again, a list of folders that satisfy this set will appear, and you will need to continue typing to indicate the name unambiguously.

Another point that may confuse you is the real names of the default folders: Documents, Downloads, etc. In fact, this is a substitution for the Russian version. And their real name is Documents, Downloads, etc. Be careful!

And finally, it should be reminded that the case of characters is important in the name of folders / files in macOS!

Recommended: