Reference 4.5 Command-Line Tips and Tricks
Here are some command-line tips that help you customize your experience and save time:
Control-click a command and choose Open man Page to read more about that command.
If your Mac has a Touch Bar, type a command and press the button for that command in the Touch Bar to view the man page. The figure shows the Touch Bar displaying a button for the defaults command man page.
Use Tab key completion when you enter file paths.
Drag and drop files and folders from the Finder to Terminal to automatically enter their locations at the command line.
Type open . (“open” followed by a space, followed by a period) at the prompt to open your current command-line location in the Finder.
Explore Terminal preferences (from the menu bar, choose Terminal > Preferences or press Command-Comma) to customize the look and feel of your command line.
To cancel a command or clear your current command entry, use Control-C.
You can edit commands before submitting. The Left and Right Arrow keys and the Delete key work as you would expect.
At the command prompt, use the Up Arrow and Down Arrow keys to view and reuse your command history. This includes editing old commands before rerunning them. Enter the history command to see your recent command history.
To clear the Terminal screen, enter the clear command or press Control-L.
To move the cursor to the beginning of the current line, press Control-A.
To move the cursor to the end of the current line, press Control-E.
To move the cursor forward one word, press Esc-F.
To move the cursor back one word of the line, press Esc-B.
To move the cursor to a location in a command string, Option-click where you’d like the cursor to be.
Use the inspector to view and manage running processes, and edit window titles and background colors. To open the inspector, press Command-I. To send a command to a process, select it, click the action pop-up menu, then choose a command from the Signal Process Group.
For more information about Terminal, read Terminal Help at support.apple.com/guide/terminal/welcome.