[SOLVED]Re: how to know if I'm using xterm or gnome-terminal?

Germán A. Racca german.racca at gmail.com
Wed Feb 24 19:56:36 UTC 2010


On Tue, 2010-02-23 at 15:41 -0500, Nalin Dahyabhai wrote: 
> On Tue, Feb 23, 2010 at 04:52:32PM -0300, Germán A. Racca wrote:
> > Hi all:
> > 
> > How to know if I'm using an xterm or a gnome-terminal from command line?
> > 
> > The output of "echo $TERM" is "xterm" from both of them.
> > 
> > How to know?
> 
> James Wilkinson already outlined why most environment variables probably
> shouldn't be trusted, so I'll suggest checking the output of
>   xprop -id $WINDOWID WM_CLASS
> 
> HTH,
> 
> Nalin

Thanks to all that answered my question with a lot of useful
suggestions.

Finally, I decided to use Nalin's suggestion and implement the following
command to know if I'm using an xterm or a gnome-terminal:

xprop -id $WINDOWID WM_CLASS | awk '{print $3}' | sed 's/"//g' | sed
's/,//g'

which returns either "xterm" or "gnome-terminal".

Cheers,
Germán.
-- 
Germán A. Racca
National Institute for Space Research (INPE)
São José dos Campos - SP - Brasil
http://sites.google.com/site/gracca
http://gracca.wordpress.com



More information about the users mailing list