Detecting used terminal application (iTerm2)

311 views
Skip to first unread message

Mikko Ohtamaa

unread,
May 22, 2012, 1:36:38 PM5/22/12
to iterm2-...@googlegroups.com

Hi,

Can one detect what terminal application is being used on an SSH remote host? I want to know the actual application, not TERM env in the question.

I'd like to detect iTerm 2 / Terminal.app so I could set OSX specific keyboard mappings instead of PC keyboard mappings.

(See ALT+arrow moving between words in ZSH and iTerm 2 )



--
Mikko Ohtamaa
http://opensourcehacker.com

Daniel Serodio

unread,
May 22, 2012, 2:08:21 PM5/22/12
to iterm2-...@googlegroups.com
I suggest you use zkbd to configure keybindings (see my answer to your superuser.com question).

HTH,
Daniel Serodio

George Nachman

unread,
May 22, 2012, 3:12:08 PM5/22/12
to iterm2-...@googlegroups.com
iTerm2 adds this to your environment:

TERM_PROGRAM=iTerm.app

I believe Terminal.app does something similar.

TJ Luoma

unread,
May 22, 2012, 5:09:59 PM5/22/12
to iterm2-...@googlegroups.com


On Tuesday, May 22, 2012 at 3:12 PM, George Nachman wrote:

> Term2 adds this to your environment:
>
> TERM_PROGRAM=iTerm.app
>
> I believe Terminal.app does something similar.
Indeed, I had the same problem.

% printenv | fgrep Terminal
TERM_PROGRAM=Apple_Terminal


However, the OP said:

> Can one detect what terminal application is being used on an SSH remote host? I want to know the actual application, not TERM env in the question.

If you are logged into a Mac on the Console and using either iTerm or Terminal, you can use TERM_PROGRAM. But if you then ssh out, TERM_PROGRAM is no longer set.

At least that's how it worked for me.

So I'm not sure this will help.

TjL



George Nachman

unread,
May 22, 2012, 5:25:36 PM5/22/12
to iterm2-...@googlegroups.com
Isn't there some way to tell ssh to pass on certain environment vars, though?

David Abdurachmanov

unread,
May 22, 2012, 5:32:55 PM5/22/12
to iterm2-...@googlegroups.com

On 2012.05.22, at 23:25, George Nachman wrote:

> Isn't there some way to tell ssh to pass on certain environment vars, though?

man ssh_config

SendEnv
Specifies what variables from the local environ(7) should be sent to the server.
Reply all
Reply to author
Forward
0 new messages