Comfortable way to archive and log terminal input

terminal

I often want to reuse a terminal command that I already used in the past. I know two ways how to do this:

  • Use the "up" arrow to browse through old commands.
  • Copy a bunch of commands into a script.

Now I'm looking for something like an archiving tool, where I could comfortably collect useful terminal inputs. Is there something more comfortable than the "up" key or copying into scripts?

Best Answer

Maybe not quite what you're asking for, but an elegant solution: Press CTRL-R and it will invoke a search through your entire history. Pressing CTRL-R again will display the next search result.

Another solution would be to use something like TextExpander etc. You define your commands there and call them by shortcuts. Unfortunately it doesn't work with the built in OS X shortcuts from the System Preferences - I did not get it working.