Manage & Resume Multiple Terminals Easier with Window Groups in OS X
Do you have your terminal windows arranged in a particular way, perhaps running particular processes, that you want to consistently resume to without having to rearrange and relaunch things? Rather than relying entirely on the OS X Resume feature, you should use the Terminal app “Window Groups” tool, which lets you save not only the placement of groups of terminal windows, but also their commands and processes. These can be quickly resumed to at any time, making it simple to manage specific window configurations and workflows for specific command line tasks. This feature has been around in Terminal app on the Mac for quite some time, but it goes largely ignored even by the most advanced command line users. Fortunately, it’s extremely simple to configure and to use, and once you get accustomed to it, you’ll wonder how you ever functioned in Terminal without it.
Save their precise placement in a “window group” and you’ll be able to quickly resume productivity, right where you left off:
Saving a Group of Terminal Windows Placement & Commands
Got a set of terminal windows and commands that you use frequently? Save it as a group:
- Organize Terminal windows on screen as desired
- Optionally; run desired commands for each terminal window that you want to resume to
- When finished, pull down the “Window” menu and choose “Save Windows as Group”
- Name the window group, and check the box for “Restore all commands”
If this is going to be a frequently used placement of windows and commands, you may want to check “Use window group when Terminal starts” as well, which sets a Terminal app specific restore functionality upon each launch, going beyond the default restoration and resume functions of OS X.
Restoring Terminal Window Groups
Ready to restore to a specific terminal group?
- Back in Terminal app, pull down the “Window” menu and go to “Open Window Group”
- Select the choice you want to quickly resume to
That’s all there is to it. Assuming you used the “Restore all commands” preference option, everything will be pretty much where you left off. If you’re going to use Terminal Window Groups for reconnecting to remote servers, be sure you have SSH keys configured so that the connection becomes automatic without having to enter passwords and login details, otherwise you’ll need to continuously authenticate with each resume of a window group that has remote sessions.
Get specific with this and you can have a terminal window group defined for completely different tasks, or for different times of day. For example, you may have a routine group of windows used for a specific set of tasks with a particular placement and set of commands running, like a large lynx browser on half the screen, with nettop monitoring network traffic in one corner with an active SSH connection to a remote server – save that as a window group and you can instantly resume not only the placement, but also those commands themselves, anytime, just by selecting that saved window group.
Another great perk to terminal.app specific Window Groups? They work even if you have the system-wide Window Restore feature turned off in OS X. Give them a try, you’ll be more productive.
Hello,
When I try to save a window group, It doesn’t give me the option to restore all commands etc. The only option given is use window group on startup. And then the group opens up as all new terminals.
I am using mac OSX 10.6.8. Was this feature added on only after Snow Leapord?
Ugh. You should just use iTerm2.
Great article. But when I restore a Window Group, I’m not being automatically logged back into my remote sessions. I am able to ping the remote server, and I do have my ssh keys setup. Any ideas why this doesn’t work still?
Another piece of information…
When I restore my Window Group, it doesn’t even attempt to re-login to the remote servers. It just comes up as a new terminal session.
Use the remote login option in the terminal menu.
shell-> new remote connection (and then specify the ssh command you want). That way when you restore it also logs you into the remote server and runs the command you want… e.g. remote top, etc.
Thank you. That is very useful.
How do you restore tabs or windows working directory i you use custom shell?
I use: /opt/local/bin/bash -lhi