Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create terminal groups for managing multiple windows Apps
As a unix switcher, I use a LOT of terminal windows. Usually one for personal mail, one for work mail, another for a persistent, screened, talkd session, and a whole lot of windows for vim, compiling, and testing if I'm doing any coding. On my 12" powerbook, this can become awfully unweildy very quickly.

My solution is to partition my terminal windows into multiple sets, each with a separate icon in the dock. Then I can switch between groups of terminal windows just as I would switch between different applications. You can see what this looks like in the screenshot to the left.

Steps:

  1. Make a copy of Terminal.app, named something like Terminal2.app
  2. Open the duplicate Terminal application's Info.plist file (Control-click the app, select Show Package Contents, open Contents folder). Change the value for CFBundleSignature from trmx to trm1.
  3. If desired, replace the file TermDoc.icns with one to identify this terminal group. I added a number to the icon, but changing the color might be a good approach as well.
Keep in mind, due to Finder caching, you might not see the icon changes until after a restart, or moving the app to a new volume (is there a better solution?).
    •    
  • Currently 4.00 / 5
  You rated: 5 / 5 (5 votes cast)
 
[10,006 views]  

Create terminal groups for managing multiple windows | 22 comments | Create New Account
Click here to return to the 'Create terminal groups for managing multiple windows' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create terminal groups for managing multiple windows
Authored by: lanej0 on Nov 25, '03 11:12:56AM

Why not use iTerm? It's freeware, and you get tabs.... Nothing could be finer than having 10 tabs open in a single window.



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: notmatt on Nov 25, '03 11:38:17AM

Because iTerm's tabbing doesn't actually solve the problem at hand. The point of having multiple windows open is to be able to see them all, not have them all in one spot. Though I suppose you could apply the same technique to iTerm as well, it also has the bonus side-effect of allowing you to command-tab through the terminal groups.



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: shneusk on Nov 25, '03 11:58:18AM
in addition, if you want just to switch between multiple terminal windows where only one is displayed at a time, using the screen command works just as well as tabs and I think it's the preferred solution for the unix geek. I love screen because it lets me share one terminal over three computers, my mac then ssh connections from my pcs just use
screen -x
to attach a screen session that's already attached somewhere else. see man for more info

[ Reply to This | # ]
screen
Authored by: pwharff on Nov 25, '03 01:44:36PM

WOW, I tried out "screen" and this is an awesome utility for any unix/linux terminal management. Thank you, this will save me time!



[ Reply to This | # ]
screen
Authored by: pobs on Nov 26, '03 02:05:53AM
This is really helpful. THANK YOU for this one. I am finding it helpful for using man pages to figure out how to use new unix cmds (i.e. man screen ). I imagine it would also be helpful for using with sftp sessions huh?

[ Reply to This | # ]
screen
Authored by: vaiism on Nov 26, '03 11:30:22AM

You can also find an article on installing and using screen at:

http://www.sun.com/bigadmin/features/articles/gnu_screen.html



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: kjaleel on Nov 26, '03 05:32:21AM

the only problem I have with screen is I cannot figure out how to make it retain the history of past scrolled lines in *all* windows it has open.

for example, lets assume I have two windows open and there is activity happening in both (lines scrolling by). If I now switch from the current window to another one and try to scroll up to see previous lines that have scrolled by, I can't! It forgets those lines and only shows lines from the window I just switched from.

I really hope someone can tell me how to do this, it's the only thing I haven't managed to figure out even from the man pages. iTerm is really slow for me as well and the combination of GLTerm and screen is just "perfect".



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: Thom on Nov 27, '03 11:59:21PM

I don't know if this is the best way to access the buffer, but what I do is use screen's copy/paste command.

Use the meta key (typically ^a), then '[' to access copy mode.
From there, the arrow keys move the cursor or ^y scrolls up line by line.
When you're done reading scrollback, hit esc, or spacebar twice.

Be careful not to leave the screen in copy mode because it will freeze the shell and sometimes interfere with your process (e.g. ircII or whatever).

You can increase the size of your scrollback per window in your .screenrc file using the 'defscrollback #' command, where # is the number of lines you want. The more you ask for, the more memory each screen will consume. Or you can specify it on a per-screen basis using ^a, ':', 'scrollback #', (return). Use 'man screen' for more details.

HTH,

Thom Brooks



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: Thom on Nov 28, '03 12:04:12AM

I don't know if this is the best way to access the buffer, but what I do is use screen's copy/paste command.

Use the meta key (typically ^a), then '[' to access copy mode.
From there, the arrow keys move the cursor or ^y scrolls up line by line.
When you're done reading scrollback, hit esc, or spacebar twice.

Be careful not to leave the screen in copy mode because it will freeze the shell and sometimes interfere with your process (e.g. ircII or whatever).

You can increase the size of your scrollback per window in your .screenrc file using the 'defscrollback #' command, where # is the number of lines you want. The more you ask for, the more memory each screen will consume. Or you can specify it on a per-screen basis using ^a, ':', 'scrollback #', (return). Use 'man screen' for more details.

HTH,

Thom Brooks



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: celsomartinho on Nov 25, '03 12:06:10PM

iTerm is great but it's rendering is *so slow* I can't work with it. A shame. If only Term.app would support tabs...



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: eilers on Nov 25, '03 11:53:47AM

If it is ok to use the X-Server, you may use the KDE-konsole which provides many consoles in one window..



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: dergl on Nov 25, '03 12:23:13PM
There is an even easier way, than to patch the Info.plist.

You can save Terminal sessions. I do so by coloring the background in different ways and save the terminal window (Save As...). Default save folder should be ~/Application Support/Terminal. Give the .term file a name you can remember (in your case mail, screen, talkd etc.).

Then drag this folder into your dock (the area where trash and minimized windows live in). Maybe you want to give the folder a fancy icon.

In addition to this you can even open the term-file in your text-edit or property-list-editor and add something like the following:
<key>CustomTitle</key>
<string>My Server</string>
<key>ExecutionString</key>
<string>ssh 1.2.3.4</string>
where ExecutionString is the command you want to be executed automatically. Above sample with some use of ssh/authorized key, will let you login onto your favourite ssh-server in no time.

I'm missing a feature in Terminal.app letting you choose this .term files in the context-sensual menu. Anyway, I wrote a little app which looks into the above mentioned folder and will let you choose them from the status bar. Email me if you want it (it's alpha.)



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: Tom Robinson on Nov 25, '03 01:38:06PM

What context sensitive menu do you mean--the one in the Dock?

I just use the File -> Library menu to open my saved terminals (new in 10.3).

And yes, having the sessions with different colours is great for a quick reminder of their purpose and finding with Exposé.



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: notmatt on Nov 25, '03 04:54:55PM

I've done this before as well, but using the renaming method in addition makes it even better because it allows you to command-tab between sets of terminal windows, something that simply setting up terminal groups doesn't do.



[ Reply to This | # ]
Corrrect path for .term files
Authored by: clarkcb on Nov 26, '03 04:21:54PM

To get your .term files to show up in the File -> Library menu in Terminal the files need to be stored in ~/Library/Application Support/Terminal.



[ Reply to This | # ]
Icon refresh
Authored by: joshyx on Nov 25, '03 04:42:52PM

When developing OSX Java apps I've had this problem. My solution has been to rename the application from Terminal. If you do it from Finder then Finder will remember the old data still. If you do it from the Terminal then Finder will think it's a new file and refresh the icon (and other metadata).

ex:

mv Test.app Test2.app

- Joshua



[ Reply to This | # ]
Create terminal groups for managing multiple windows
Authored by: randycarpenter on Nov 25, '03 11:21:40PM

I've been happy using the tabbed feature of iTerm and manage groups of terminals with multiple tabbed iTerm windows.

http://iterm.sourceforge.net/



[ Reply to This | # ]
Better terminal
Authored by: T u r b o on Nov 25, '03 11:23:40PM

If you really use the terminal enough that this is even an issue, do yourself a favor and check out GLTerm:

http://www.pollet.net/GLterm/

It is *THE* number one app on my macs, even though it hasn't been updated for a long time it works perfectly, and it's the fastest terminal app I've ever seen for any platform...

I use a prompt and aliases that set the titlebar of each window to exactly what that window is currently doing... Combined with the dock flyout menu I can find exactly what I'm looking for very quicky...

I wish it were OSS because there's still a few things I'd like to tweak, but it's the best $10 I've ever spent on software.

- Mike



[ Reply to This | # ]
Using screen and GLTerm is great, but ...
Authored by: kjaleel on Nov 26, '03 05:35:29AM

*sorry for reposting this*

the only problem I have with screen is I cannot figure out how to make it retain the history of past scrolled lines in *all* windows it has open.

for example, lets assume I have two windows open and there is activity happening in both (lines scrolling by). If I now switch from the current window to another one and try to scroll up to see previous lines that have scrolled by, I can't! It forgets those lines and only shows lines from the window I just switched from.

I really hope someone can tell me how to do this, it's the only thing I haven't managed to figure out even from the man pages. iTerm is really slow for me as well and the combination of GLTerm and screen is just "perfect".



[ Reply to This | # ]
Using screen and GLTerm is great, but ...
Authored by: dpwk on Nov 26, '03 05:29:31PM

I've used screen for a decade, and I don't believe there is any way to accomplish this. The reason is that the scrollback buffer is outside of screen's control: a (any) Terminal application just says to the UNIX host "Hi, I have a text window 80 (or so) columns wide and 44 (or so) rows high, tell me what you'd like to display in it!" Any text within the window is available to UNIX (and screen), and anything even one line above the window* is gone forever from UNIX's awareness- it exists only as a memory structure in whatever terminal emulator you are using- the usual interface to it is the scrollbar.

When screen swaps the text on your screen as you attach to a new session, it has no way of swapping the text in your scrollback buffer. This is indeed the big drawback of screen, and not one that can be easily circumvented. (I suppose you could somehow convince some terminal emulators to give you a window say 500 lines high, but that would lead to really lousy performance and most likely some bizarre display problems.)


Ultimately, your scrollback ends up being a series of fragments of the screens you have recently visited. Tis the nature of the beast.

*the only exception here is this: if you type screen into a window Y rows high, and then later reattach to the session (screen -x) in a window that is fewer than Y rows high, screen will still attempt to provide those rows that were present in the first window from which you launched screen. Same goes for width of the window. If you do the opposite and reattach with a larger window, the original vertical size of the screen will be indicated by a dashed line at the bottom of the new window.

---
gigabling megashiznit



[ Reply to This | # ]
screen history
Authored by: a1291762 on Nov 27, '03 08:51:01AM

Ahh grasshopper... You are trying to view screen's history from the terminal. This is impossible. You should instead view screen's history with screen itself. It does keep history.

The way I generally do it is to go into "copy mode" ^A[ and scroll up (page up works too) from there. Enter twice to leave copy mode.

I'm sure there's a better way to do it but that's what I've always done.



[ Reply to This | # ]
screen history
Authored by: dpwk on Dec 01, '03 09:38:44PM

OMG that is so SO cool. I couldn't be happier to be proven wrong!

Hats off to you and macosxhints.com (which, have you noticed, comes up rather a lot in random unix searches..?)

best and happy ^A[-ing,
David

---
gigabling megashiznit



[ Reply to This | # ]