Terminal provides a command line interface to control the UNIX-based operating system that lurks below macOS (or Mac OS X). Here's everything you need to know about Terminal, and what it can do for you and your Mac.

What is terminal all about?

The first thing to understand about Terminal is that it's just an application and it lives in the Utilities folder in Applications. You launch it like any other and when you do, you'll see Apple's implementation of a Unix command-line environment, known as a shell. There are various types of shell; Apple uses one called Bash.
The title bar of a Terminal window displays the name of the current user, the type of shell, and the size of the window in pixels. If you look at the command-line inside the window, you'll see that each line starts with the name of the Mac and is followed by the name of the current user. The 'cursor' is indicated by a shaded box.
You can run other shells with Terminal, but you'll have to install those yourself. Commands in Unix are shell-specific, so it's important, say when you're following tips written for a different flavour of Unix, that you use the right shell for the commands, or vice versa.

How to use Terminal on a Mac

We're getting ahead of ourselves, however. Using Terminal is straightforward: you type a command on the command-line and press Return to execute it. A command has three elements to it; the command itself, which calls a specific tool, an option which modifies the command's output, and an argument, which calls the resource on which the command will operate.
Often, the argument takes the form of a specific file, in which case you need to type the file path at the end of the command. There is a shortcut, however. If you locate the file in the Finder, you can drag and drop it onto the Terminal window and Terminal will extract its path and slot it into the command for you.
There are a few rules that you need to bear in mind when using any command-line interface. One of these is that every character, including spaces, matters. So if you copy a command from a website, magazine or book, you need to make sure you type it exactly as it's shown.
You can rerun previous commands without retyping them by using the up arrow on the keyboard to navigate to the command and then pressing Return. And you can interrupt a command by pressing Control-C.

To see a list of available commands, hold down the Escape key and then press Y when asked if you want to display a specific number of possibilities. You'll see a list of commands, with their meanings next to them. If you press spacebar more commands will load. Press Q to exit and return to a command prompt.
Unix has its own built-in manual and you can call it in Terminal to find out more information about a command. To use it, type man [command], where 'command' is the name of the command on which you want more information.

When you type a command in Terminal, it's executed in your current location, unless you specify otherwise. When you launch a new Terminal window, that location is at the top level of your Home directory, so every command is relative to that location.
To change location, use cd followed by the path of the location you want to move to. To return to the default, type cd ~/ and your location will change from wherever you are to your Home directory. You can view a list of the files and folders in your current location by typing ls (that's a lower-case LS) to list them in Terminal.


Post a Comment