Using “Marks” in Terminal

Using “Marks” in Terminal

Marks are a little used feature in Terminal but can be insanely useful depending on how you use Terminal. I’ll explain by example.

Copying the output of a command

The usual way:

  • Start with a Terminal window where you’ve run a number of commands already
  • Run a Terminal command that spews a lot of output
  • Decide you want to move the output into a bug report or email
  • Hunt in the Terminal window for where you typed the command and manually drag or shift-select to get just the output of the command.

Alternative using Marks:

Hit Command-Shift-A and it selects all the output of the most recent command.

Navigate between commands

The usual way:

  • Run a series of Terminal commands that spew a lot of output
  • Decide you want to navigate between the various commands along with their output
  • Scroll around and use prompt color or some other means to find each of the prompts to see the commands and output

Alternative using Marks:

Using Command-UpArrow and Command-DownArrow to jump between each prompt. Combine this with the first tip above to navigate between prompts and then select only the output for that command.

Genius.

Extra credit:

Look in the Edit menu for anything that mentions “Marks” and there is some neat stuff in there for users needing more than this simple trick.