Article
Kyle Baxter · Oct 10, 2019 2m read

A simple trick I wish someone had told me 10 years ago

Are you all ready for something you wish you knew ages ago (or, in my case, a DECADE ago)?  Open up a portal in your favorite instance and go to:

System Administration->Configuration->Additional Settings->Startup

Scroll down to "Terminal Prompt" and click 'Edit'.  This allows you to edit what you see on your terminal prompt.  You can change that to my current setting: 8,3,2

What does this do?  It adds your instance name for your prompt.  So now your prompt can look like:

DEVELOPMENT:USER>

Congratulations, you will now NEVER be in the wrong instance again (remember the last time you were trying to fix a bug and you couldn't get things to work and you wasted the better part of an hour only to realize you were in the wrong Terminal the entire time?).  There are other useful bits there - but you can read about it in the page.  There is (obviously) a cpf parameter for this, under the [Startup] tag: TerminalPrompt=8,3,2.

Your portal options are more limited, but you can have a header on the page depending on the type of system.  Go to:

System Administration->Configuration->System Configuration->Memory and Startup
 

and change the "System Mode" to be the appropriate value.  How sweet is that!?

Thanks to @Mark Hanson for showing me this setting, and to @Jenny Ames  for encouraging me to post this on the DC.

Edit: Many in the comments have said they're using 1,3,2 (Host,Instance,Namspace) with the 8 (transaction level) thrown in somewhere.  I think this makes a lot of sense.  Obviously you should use the combo that works best for you, but I wanted to outline one that gives all the information you might need to identify an instance.

 

Edit 2: OH NO!  @John Murray pointed this out YEARS ago and I missed it!  Sorry, John!!!

https://community.intersystems.com/post/where-am-i-adding-extra-information-terminal-prompt

 

12
1 1,113
Discussion (11)6
Log in or sign up to continue

Wow! 

@Kyle.Baxter simple and awesome trick! I'm working with InterSystems technologies since Caché 5.0 in 2003 and never figure this out!

This trick is helpful

Maybe I should edit the title to say 16 years!!!

That's why I like to post stuff like this.  60 seconds of work that can save you hours of frustration are tricks worth knowing about.

A friend of mine @VICTOR GALVAO used your approach and modified a little bit: 

Using the parameters "1,8,3,2" you can get SERVER:INSTANCE:NAMESPACE>  

Hey Kyle, 

You're a font of useful knowledge, another great nugget of info. I just wish there was a way to default the terminal colours so that I could see instantly which server I'm on, or even if its just production, testing or dev. 

I use a chrome plugin called URLColors that puts a colour wash over the page for my Management Portals so that I can see really clearly which server I'm operating on. If it has a red hue then I need to be careful, if it's green then I'm fine to play! 

Cheers for another great time and especially for sharing it, (although I've gone for 1,8,2 ;] )

I just wish there was a way to default the terminal colours

Easy to do that.

Create %ZSTART routine:

LOGIN
    // Color options. 54 - red
    // for i=1:1:60 write $j(i,2),"  ",$C(27)_"["_i_"m"_"Hello"_$C(27)_"[0m",!
    write $C(27)_"[54m"
    quit 1

And done.

Here's the result

Thanks for sharing this, @Kyle.Baxter!

BTW, what is the programmatic way to make this setting?

Set terminal prompt.

  • For everyone: Config.Startup:SetTerminalPrompt
  • For current process: $system.Process.TerminalPrompt  

To set system mode set ^%SYS("SystemMode") global to whatever value you want. Highlighted values are: LIVE, TEST, DEVELOPMENT, FAILOVER.

Oh no! I did miss it!!!  Sorry John!