Start by Opening Terminal
Of course, your first step will be to open Terminal. There are several options to do that, but the easiest is to press Command + Spacebar to open Spotlight, then search for “Terminal.” The Top Hit should be the Terminal app. Double-click to open it.
When the Terminal window opens, you can resize it by dragging one of the corners to expand. You can also change the look of the app by going to Terminal > Preferences or pressing the Command+, (comma) keyboard combination. In the Profiles dialog box that appears, you can change the appearance of the command windows to match your style or needs.
Once your Terminal window has the appearance you prefer, then you can start using it to execute commands on the computer.
The Basics of Terminal Commands
You can do a lot of cool (and useful) things with the terminal. For example, if you really want to, you can use a Terminal command to make your Mac speak to you. But before you start, it’s helpful to know how Terminal commands are written.
Each Terminal command has three parts.
The command: This is the actual letters that you’ll type into the Terminal window to execute a command. Be very careful when using Terminal commands, because some commands can delete files or cause other damage to your system that might stop your computer from working. An argument: This part of a command tells which resources the command should work on. For example, should a cp, or copy, command copy this window or another?An option that modifies the output: This is a directive about where the results of a specific command should appear.
For example, if you want to move a file, you would use the command mv. The argument for that command would be the location of the file you want to move. And the output would be the location you want the file moved to. So to move a file from your desktop to your Documents file might look like this:
That command says, “Move (the command) the file TerminalTestFile.rtf (the argument) from my Desktop to my Documents (the output).”
Rules for Using Terminal Commands
Now that you understand the basics of how to write and use Terminal commands, there are a few rules that you need to understand.
When using terminal, you must always type the command and then press Enter or Return on your keyboard. You cannot use the mouse to interact with the Terminal window beyond using the Close, Expand, and Hide buttons in the upper left corner of the window. To interrupt a command that is running type Control+C. To quit Terminal without using your mouse, type Command+Q. Commands automatically execute in the last used location on your computer. If you want to specify a different location for a command to execute, you’ll need to use the cd command and a directory path to specify the location you want to command to execute in.
One more note before moving on. If you’ve never used terminal before you may be confused when you execute a command and nothing happens in the Terminal window. Don’t worry. In many cases, that’s exactly what is meant to happen.
For example, when you type cd ~ you’ll be returned to the Home directory. In your Terminal window, your cursor will advance to the next line with no indication that anything happened. Rest assured, you’re now back in your Home directory.
Using Terminal Commands on a Mac
With the basics out of the way, you can start using Terminal commands to move around faster and be more efficient as you’re using your computer. Here are a few Terminal commands that you can try to get your feet wet, but there are dozens of Mac Terminal commands you can use to fit nearly all your needs.
Most basic Terminal commands involve navigating files or directories on your computer. For example, you can use the command ls (that’s a lower case L, lower case S) to view a list of all the files in the current directory. So, if you are in Documents and you type ls, you’ll see a list of all the files in the Documents directory (or folder).
You can modify (or change the output) of the ls command by adding operators. For example, ls -C sorts the files in the requested list by size.
Here are some additional basic commands you can try: