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

Default start-up commands in custom terminals Apps
Not sure if anyone has posted this hack, but...

If you use custom Terminals for various tasks such as one terminal to telnet or ssh, and one terminal to tail a log file, etc. you can edit the .term file for each custom terminal to keep the shell you'd like to use -and- to also start up any default program or script you'd like.

If you'd like to set custom terminals with custom commands and still use your default shell, read the rest of this hint.

[Editor's note: This is similar to a tip that has been previously published, but it's a nicer wayto accomplish the same objective, so I've published it as a new hint]

To set your custom terminal command, just open your saved terminal file, say 'Custom.term' for example, and find the key-value pair:

<key>ExecutionString</key>
<string></string>

and add whatever command you want the terminal to launch on start-up.

For example:
<key>ExecutionString</key>
<string>/usr/bin/ssh -l username remote.host.comn
</string>

(Note: replace 'n' with return to actually execute the command automatically )

I've seen other posts that recommend replacing the 'Shell' key in the .term file with the command you want executed, but that strips the shell out from under you - and I was having problems using ssh that way. With the 'ExecutionString' hack, you get the shell you want and the default start-up command you want

I use this hack along with others that have been posted here at 'Mac OS Hints' to set up several Terminals, each with different color schemes, Titles, and start-up commands - all using the shell I want, and all available from either the 'Library' menu in Terminal.app or from the dock

Terminal.app is fun stuff...
    •    
  • Currently 3.13 / 5
  You rated: 5 / 5 (8 votes cast)
 
[6,935 views]  

Default start-up commands in custom terminals | 5 comments | Create New Account
Click here to return to the 'Default start-up commands in custom terminals' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
.term where is it?
Authored by: Morwen on Jun 12, '01 09:14:16PM

Okay, I was excited to find your tip, cause I open 3-4 ssh and telnet sessions every day at work. Unfortunately I don't seem to have a .term file that I can find. I've changed the Terminal prefs and saved, its not making a .term file. Its saving the prefs in Library/Preferences/com.apple.Terminal.plist but there isn't any <key> like you mentioned in that file either. :(



[ Reply to This | # ]
.term where is it?
Authored by: robg on Jun 12, '01 09:20:20PM

You have to create it -- set up the terminal the way you want, then File -> Save and name it something. You now have a ".term" file.

-rob.



[ Reply to This | # ]
.term where is it?
Authored by: Morwen on Jun 15, '01 11:02:56PM

Duh, that was pretty obvious for me to miss, thanks. heh

Okay, been there, done that. Shell/Open will launch my new custom .term files, however, they don't show up in Shell/Library menu. Nothing does. Tried copying them from my home Library to the root library and owning them to root even. Still nothing. Are they supposed to show up there?



[ Reply to This | # ]
.term where is it?
Authored by: jrmckee on Sep 10, '01 05:44:05PM

Create the directory ~/Library/Terminal, then save all your .term files there. They will now show up in Shell>Library



[ Reply to This | # ]
New Terminal Library location / using PropertyListEditor
Authored by: popguru on Mar 06, '02 10:04:24AM

Just to update this hint...In recent versions of OS X, the location to put .term files so they show up in Terminal's Shell->Library menu is:

~/Library/Application Support/Terminal/

Also, a convenient way to edit .term files other than using a text editor is to open them with PropertyListEditor (since a .term file is just an XML .plist in disguise). Just launch PropertyListEditor, and then drag the .term file into PropertyListEditor's dock icon while holding down the command and option keys. Holding down the command and option keys is necessary since otherwise PropertyListEditor won't recognize the .term file as a file it can open.



[ Reply to This | # ]