The Mac Terminal is both terrifying and powerful. It is like a completely different computer that lives under the beautiful macOS interface. Sometimes it is complicated. Other times, it seems focused on the laser, offering a much faster way of doing things. Instead of clicking and dragging across multiple screens, simply type a line of text.
However, the Mac Terminal is quite intimidating if you're not used to it. Today we will learn five super useful Terminal tricks that make moving much easier.
You will see how you can integrate with the Finder and how you can drag and drop files and folders into a text-based Terminal window.
Tips and tricks for Mac Terminal
These tricks are like learning to click with the right mouse button: they are the abbreviation that makes Terminal much easier to use. In a short time, you'll look like a tough hacker from a television show.
First, open a Terminal window on your Mac
Terminal is an application for Mac. You will find it in the folder Applications> Utilities . Launch it and it will probably open a window that looks like a normal TextEdit window, a white panel with black text. You can change the appearance in the application preferences.
I think black on white is easier to read, but I also like being able to see the Terminal window among other open windows. Then I go for the green text on a black background. (You can choose between several preset profiles).
The Terminal can do almost everything your Mac can do in normal use, and more. Usually, it will work on a file or a folder full of files and execute commands on those files. Most of the following tips show you how to work with files and folders more easily.
How to open a folder in the Mac Terminal
To open a folder, simply type cd (change directory), followed by the folder path. For example, to open the Documents folder in your home directory, simply type
cd ~ Documents and press Enter. Now you are "in" your Documents folder. However, you still cannot see any of the files.
To list all files in the current folder, type ls (file list) and press Back . All files and folders will be listed. How can you tell the difference? The folders are listed first and the files later. And the files are shown with their file suffix:
interesting file.txt for example.
But what happens if you don't know the route? Or don't you mind writing it? After all, you probably already have the folder open in a Finder window. This is the first trick. Simply type cd (including space) and then drag any folder from the Finder to the Terminal window. Your route will be pasted in the Terminal, and you can press Back to open it.
Open the current route of the Terminal in the Finder
How about the other way around? You are inside a directory on your Mac and want to open it in the Finder. This is even easier. Simply type open. (that is open space period ). Then press Return and the current folder will open in a Finder window.
The up arrow
Imagine you wrote a long and carefully designed Terminal command. And now you want to use it again. You may want to apply the same command to a different file. Do you have to write everything again? Copy and paste the command? No Simply press the up arrow and your previously written command will be added to the current command line, ready for you to edit or reuse.
Continue to touch the up arrow to continue in time, one command at a time.
Make deletion work correctly
If you are used to using the ⌘, ⌥ and ⇧ keys to move the cursor around the text, or delete a complete line using ⇧ ⌘ backspace for example, then the Terminal will quickly frustrate you. While ⌥ ← will move the cursor back one full word at a time, ⌥ backspace removes only one letter.
Here are two options. One is to play Escape before touching the backspace key. That will delete the whole word before the cursor. Or, if you have a route like
~ / Documents / Folder / Another Folder / textfile.txt then Escape Backspace will remove fragments of that route, treating the characters / as spaces.
Or you can click Edit> Use option as Meta key in the menu bar ( ⌥⌘O ), and the Option key will modify your shortcuts in the same as it does in a normal text editor.
Undo the script
You will not realize how deep the shortcut is rooted ⌘Z undo your brain until you use Terminal. Stuck the wrong thing in a window? Hard. There is no undo. Or does it exist?
The closest equivalent to ⌘Z is ⌃_ . Yes, it is a pain to get used to it, but it works more or less. If you paste a long command or path, you may have to press the shortcut several times before everything disappears, but it surely overcomes the elimination of the complete error, one letter at a time.
More terminal tips  If you have more suggestions for Mac Terminal noobs, add them in the comments. Specifically, tricks and tips that will help people move from the normal macOS environment to the strange world of the command line.
And, if you are entering this world for the first time, good luck! Hopefully, these tricks will make your trip easier.