Use marks and bookmarks in Terminal
Marks and bookmarks add structure to the Terminal window content. They enable operations like navigating to previous command prompts, selecting and copying command output, and clearing the most recent command while leaving others in place.
Terminal has two mark styles: square brackets ([ ]) and vertical bars (|). The marks are placed at the right and left edges of the window.
Square brackets are typically used to mark command-line prompts. By default, prompt lines are marked with square brackets when you press Return, Control-C, or Control-D.
Bookmarks are a heavyweight mark—both visually and behaviorally—that are denoted by vertical bars. They are typically used to mark larger sections of content. You can bookmark selected rows or insert bookmarks into the output log. The inserted bookmarks can have a timestamp or custom label.
Add and remove marks
Marks are applied to existing lines in the Terminal output log.
Mark a selection with square brackets: Select the rows you want to mark, then choose Mark as Prompt from the shortcut menu.
Mark a selection with vertical bars: Select the rows you want to mark, then choose Mark as Bookmark from the shortcut menu.
Remove a mark: Select the rows you want to remove marks from, then choose Unmark from the shortcut menu.
Enable or disable automatic prompt marks: Choose Edit > Marks > Automatically Mark Prompt Lines. The checkmark lets you know whether the option is enabled.
Insert bookmarks
Bookmarks are inserted into the Terminal output log.
Insert a bookmark with a date and timestamp: Choose Edit > Bookmarks > Insert Bookmark (or use the Touch Bar).
Insert a bookmark with a custom label: Choose Edit > Bookmarks > Insert Bookmark with Name. Type a name for the bookmark, then press Return.
Locate marks and bookmarks
Locate adjacent marks: Choose Edit > Navigate, then choose an option in the submenu.
Locate a specific bookmark: Choose Edit > Bookmarks, then choose a bookmark from the list at the bottom of the submenu.