These are the notes and links for my five-minute speed presentation at the Houston Apple Admins Virtual Meetup on May 5, 2020.
- Moving to zsh
- Terminal and Shell (coming soon)
And because I had to talk quite fast, here are some notes:
1. Prompt Navigation
You can use the arrow keys in Terminal to move the cursor by character or by word (with the option key), but to move to the beginning or the end of the line, you need to memorize ctrl-A and ctrl-E.
2. Keyboard Assignments
You can also add modified arrow key shortcuts in the ‘keyboard’ tab of the ‘Profiles’ area in Terminal Preferences. Add a key code for shift-option-left arrow and assign ctrl-A. Repeat for shift-option right-arrow and ctrl-E.
3. Option Click to Move Cursor
Even easier is navigation with the mouse pointer. Option click in the prompt, to move the cursor there.
4. Option Drag to select rectangle
When you hold the option, the mouse pointer turns into a crosshair. With option-drag, you can do rectangular text selection in Terminal. This is especially useful for certain list outputs.
5. Select Paths and URLs
You can double click text in Terminal to select words, and triple click to select paragraphs. However, since ‘words’ end at slashes and other punctuation characters, you cannot select paths or URLs with a double click.
Use shift-command double-click to select the entire path or URL.
6. Paste Selection
After selecting a path or URL, you often want to use it in the prompt. Use shift-command V to type the selection at the current prompt without having to copy it to the pasteboard first.
7. Paste Escaped Text
When you already have a path in the clipboard, but it contains spaces and other special characters, you can use ctrl-command V to paste and escape.
You can use command-up arrow to jump scroll the view to the previous command prompt, no matter how long its output is. You can then use command-down arrow to jump back to the next command prompt.
If you have a Touch Bar Mac, you will see these strange arrow buttons, which do the same thing.
9. Select to previous Marker
You can use shift-command A to select the output of the previous command.
10. Clear to previous Marker
You can use command-L to clear the output of the previous command. (This will not remove the command from the shell history.)
11. Man Pages from Help Menu
You can open man pages from Terminals help menu, use shift-command-slash to open the menu and start typing the command in the help search field.
You will then get the man page in a separate yellow window (you can change the color by changing the man page Profile in preferences).
12. Find in Terminal Window
This yellow man page window is extra useful because it is easier to scroll and you can use command-F to search for text.
You can of course use command-F in all Terminal windows, but it is especially useful in man page windows.
13. Man Pages from Touch Bar
You can also open man pages from the Touch Bar, just start typing a command in the prompt and select the man page in the Touch Bar.
14. Customize your Touch Bar
While we are talking about the Touch Bar, there are some useful items for the Terminal Touch Bar that are not placed there by default, use ‘Customize Touch Bar…’ from the ‘View’ Menu to change this.
14+. Sidecar provides Touch Bar
Bonus: remember that Sidecar can add a Touch Bar to a Mac without one.
15. Touch Bar: Background Color
For example, you can pick a custom background color for a Terminal window or tab from the touch bar. It even provides a bunch of different palettes.
16. Touch Bar: SSH Connection
You can also initiate an ssh connection from a customized Touch Bar. Or create a new Terminal tab.
17. Change Profile of existing Window
You can get more information about the current Terminal Window in the Info Window, which you open with command-I.
The Profile Tab of the Info Window lets you change a window’s look without having to create a new one.
18. View and manage processes
The Info Window also gives you an overview of the processes running in the Terminal window.
In this case, you can see I have a root shell running in that window. You can use the gear menu to get some more information and you can send signals, such as QUIT or KILL to a process.
19. Window Groups
When you have arranged your ‘perfect’ terminal workspace, with multiple windows in different locations, maybe even remote connections, you can save this as a “window group.”
Check the ‘Restore all commands’ option to restore working directories and reconnect to remote servers when you open the window group.
20. Command Files
When you change the extension of an executable file to dot-command, then double-clicking the file will open a new Terminal window, run the script and show its output.