I’ve been a longtime user of Apple’s Terminal.app. Although there are fancier terminals for macOS, Terminal has the features I care about and integrates nicely with the rest of the OS. Several years ago, Apple added a set of features focused on “marks.” I’m going to share three simple and common ways marks have improved my workflow.
What are marks?
As you may be able to guess simply from the name, marks are just individual lines of terminal output that have been flagged. By
default, Terminal will create a mark for each line that prompts for your input. In practice, this is usually your shell prompts. All three
of the tips below depend on leaving this feature enabled.
There are also the concept of bookmarks, which are similar to marks but must be manually created (using ⇧⌘M).
For both marks and bookmarks, there are some keyboard shortcuts for navigation, text selection, and clearing text.
Tip 1: Copy the entire output of your last command.
Let’s say that you just ran a command and now would like to copy and paste its output. This is easy, thanks to the Select Between Marks
Use ⇧⌘A, followed by ⌘C.
If you’d like to copy the output of a previous command, this is easy too. Just use Jump to Previous Mark (⌘↑) until the desired command is highlighted.
Tip 2: Jump to the start of a command’s output.
How often do you run a command that outputs well over a single screen’s worth of text? Probably a lot.
While you can manually scroll back in the history until you identify the start of the command’s output, it’s much easier to just press ⌘↑
(Jump to Previous Mark).
Tip 3: Clear the output of only your last command.
Sometimes I find that I’ve run a command that is generating a very large amount of output that I don’t really care about. It’s easy
enough to clear this output by using Clear to Start (⌘K), but often I’d like to retain the history of my previous commands as a reference.
Thankfully, there’s a menu option for this, too: Clear to Selected Mark (⌘L).
Learning to use these features has made a big improvement in my workflow. If you’re an Apple Terminal user who hasn’t discovered them
yet, you should give Marks a try.