Using Alfred Clipboard History
This is a slight enhancement of the copy-paste option that relies on the Alfred app — Alfred is a launcher, providing a faster way to launch applications or perform certain tasks by typing instead of navigating the GUI. In this case we're using one feature of Alfred which is Clipboard History. Alfred will remember the last day's worth of Clipboard activity.
Create a text file containing the commands you want to use
Select each command and copy it to the clipboard (Command+C)
For each terminal window or tab:
- Open Alfred Clipboard History (default is Command+Option+C)
- Select the command to paste
- (repeat those two steps for each command)
For me, writing the commands down ahead of time is part of planning what I'm going to do, and also documenting what I've done so my colleagues can pick up any routine task and hit the ground running.
How does this help?
Using Alfred Clipboard History in this way saves the back-and-forth between the text file and the terminals, reducing the risk of accidentally selecting a sequence of characters instead of the whole command, or accidentally deleting commands with Command-X instead of copying with Command-C, or moving blocks of text around as editors such as BBEdit allow you to do by simply dragging a selected block of text.
This option doesn't require advanced knowledge of tools like Ansible.
Problems with this option
This option can lead to confusion because Alfred's Clipboard History simply lists the clipboard history and you need to remember the order to invoke the commands in. For one or two commands, it's pretty safe. Once you have five commands you might end up invoking them out of order. In some cases you can copy blocks of commands or use ';' to separate commands on one line.