4

In the past I had used iTerm2 which makes search a non issue. However it has showstopper bugs with pasting from the clipboard so I must use Terminal instead. It seems the latter does not make searching a trivial task. The screenshot shows searching for event :

enter image description here

You will have noticed there is nothing highlighted. I don't know what it is actually doing.. Sometimes when searching maybe one element shows up. But that's not acceptable either: why are not all instances of the search term highlighted?

The keyboard shortcuts do not list any such shortcut: am I missing something there? https://support.apple.com/guide/terminal/keyboard-shortcuts-trmlshtcts/mac

2 Answers 2

5
  • Cmd+F to open the find window, and then type your find keyword
  • After you've entered your keyword, go to EditFindSelect All
  • Your search term should now be highlighted:

enter image description here

Unfortunately, this has no keyboard shortcut by default and you can't add a keyboard shortcut for this via the normal Mac settings (without installing a third-party automation app) because it would conflict with the "Select All" option that is being used as a top-level action inside the Edit menu, before the Find submenu.

However, you could add a keyboard shortcut for "Select All in Selection", the only downside to this is you have to select the region you want to highlight before executing the key combination. Here's how to set up this workflow:

  • Click on the  menu on the top-left and go to System Preferences
  • Select Keyboard.
  • Select the "Shortcuts" tab
  • Click on "App Shortcuts" on the lefthand side menu
  • Click on the "+" button, then select "Terminal.app" as the app, "Select All in Selection" in the Menu Title field, and the "Shortcut" key combination you want to use (Cmd+Shift+F in my case, but you can choose whatever you want).
  • Click "Add"

enter image description here

Now, inside Terminal.app you can use this like:

  • "Cmd-A" to select all
  • "Cmd-F" to open the find bar
  • Type in your search phrase
  • Because everything is still selected, you can use your shortcut you just specified (e.g. Cmd+Shift+F) to highlight your find keyword in your terminal window.
1
  • 1
    Great answer! Maybe not what I had hoped for : but "don't shoot the messenger" ;) I appreciate the walk through of adding the shortcut as well. Commented Feb 7, 2020 at 21:22
3

You can add a shortcut in this way:

  • Click on the  menu on the top-left and go to System Preferences
  • Select Keyboard.
  • Select the "Shortcuts" tab
  • Click on "App Shortcuts" on the lefthand side menu
  • Click on the "+" button, then select "Terminal.app" as the app, "Edit->Find->Select All" (you always have to provide the full menu entry here) in the Menu Title field, and the "Shortcut" key combination you want to use (Cmd+Shift+F in my case, but you can choose whatever you want).
  • Click "Add"

enter image description here

I have used Bill Mei's answer previously until I found out that you can actually link sub menu items.

Source: Set keyboard shortcut for nested menu selection

1
  • To find "Terminal.app" I had to select "Other..." in the Applications dropdown and then navigate to Applications/Utilities
    – rusheb
    Commented Feb 17 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .