managing terminals

hazmat

Rusher of Din
Anyone have any tips on managing Terminal windows? I would like to be able to save sessions (colors, etc.) for different ones, and also automatically run a command for each one. Mostly automatically sshing to a remote host. I see that you can save .term's, but I am having a hard time trying to figure out how to manage them. I would like one for regular system stuff for the local system, but be able to open the other session profiles as well. I found that when I tried making a second one, when I hit command-n it would make a new Terminal windows in that other session. Sorry if this sounds confusing. I'm used to using SecureCRT in Windows NT where session management is painless.

Thanks for any help.
 

beef

Dinner
#1 setup .tcshrc for something you want done in all terminal files that runs tcsh (or .whatever for whatever shell)

environment variables, etc... you might want to set up aliases as well, I put it in another file, but I forgot why I did it.

#2 use inspector (shell menu)

set color, window size, etc. custom title for each terminal window might be useful as well.

#3 save .term files

after setting up a window the way you like it, including position, save.
the file should be in ~/Library/Application Support/Terminal/

#4 If you want a term to run an app

for example, if you want a term file just to run emacs.
create a new terminal window. follow #2, #3. we'll call the file. emacs.term here. close the window.

open emacs.term with a text editor

search for "shell" (you'll find <key>Shell</key>
edit the line below (probably <string>/bin/tcsh</string>), change it to
<string>/usr/bin/emacs</string>

save

when you open emacs.term, it'll run emacs, and when you quit emacs, window will close (if you have set the window to close in preference).

now, to be able to open emacs.term from another terminal window, set up alias for it in .tcshrc or whatever file you set alias.

for example

alias runemacs 'open "~/Library/Application Support/Terminal/emacs.term"'

save the file, load it ("source .tcshrc" or whatever file you put aliases in)

type runemacs, and the window will appear.

you can switch emacs with other programs, or some script you've written. If you want to run some app with particular settings, then you probably need to write a script to do so.

#5 if you want a terminal window that performs particular task when opened

new window, #2 #3, then open the .term file, and search for "Execution String" (<key>ExecutionString</key>)
write whatever you want it to do between <string></string> (follow it with return key, no don't type "return key", just hit it, yes it will look unorganized), save. You can write as many commands as you want.

example, if you write <string>date</string>, the terminal will display date when opened. (then it's just another tcsh shell) (this example is lame, but I need to go soon, couldn't come up with anything useful).

Ok, I think that's about it... or maybe not, but a telephone call made me forget whatever I was going to type...:eek:
 
Top