Immensely useful OS X Terminal tip

So tonight I got to really playing with Mac OS X’s Terminal app, and I found a huge time saver.

First, you may have noticed that you can “save” a Terminal, but if you’re like me, you probably assumed that that command would save the contents of the Terminal window. Oh no. Saving a terminal actually saves the Terminal settings, so you can save the size and position of a single window, for example, or you could save all the windows you want to start up when you launch Terminal.

Okay, that’s fine and dandy, but let’s make this more useful. Open /Users/name/Library/Application Support/ and make a new folder named Terminal . Now, back in Terminal, save your term’s into that folder. Now, see that “Library” item in Terminal’s file menu? Hey, look at that, the contents of /Users/name/Library/Application Support/Terminal/ are in that menu item! Hoo ha!

But oh, that only opens the window with that configuration… I want a given window to ssh directly to my favorite server! Well, that’s more than doable! Just edit the saved terminal configuration in your favorite text editor, find the key “ExecutionString”, and set the string to be whatever command you want to execute when you start load that saved configuration. You can also edit the CustomTitle of that window while you’re at it, so all of your favorite windows have useful names.

And last but not least, open the Terminal preferences, and on the Statup pane, set it to open one of your saved configurations with lots of windows instead of just making a new shell! Alternatively, toss your Application Support/Terminal folder into the Dock, and then you can open any of your saved configurations from any program you’re in.

Wow, this stuff will probably save me five to ten minutes a day that I used to spend setting up my Terminals.

Later: A few other terminal tips:

  • `open` – Use the open command to open Mac OS X apps from the Terminal. `open /Applications/Utilities/`, for example, would be pointless, because you’ve already got the terminal open… But you get the idea.
  • `open file` – Works just like double clicking file, opening the appropriate application and everything. `open`, for example, would launch Quicktime.
  • Dragging files and folders from the finder into a Terminal window will print the path to that file or folder for you to use in your unix schemes.

17 Responses to “Immensely useful OS X Terminal tip”

Comments are currently closed.