1

I added a line to $HOME/.profile just for interest.

echo ${TERM:-"\$TERM isn't set."} > $HOME/term/.profile

After the next login, I saw a word dumb in $HOME/term/.profile.

$ cat term/.profile 
dumb

Then I opened gnome-terminal and typed echo $TERM. The result was xterm.

$ echo $TERM
xterm

When is $TERM replaced from dumb to xterm?

I know there are some similar questions and saw them, but I couldn't understand them enough for finding the answer.

There is neither .bash_profile nor .bash_login in $HOME.

And this is who command's output:

$ who am i
cul8er   pts/1        2015-11-25 05:31 (:0)

OS: Ubuntu 15.04.

6
  • Unless you're telling GNOME Terminal to run login shells, it doesn't run .profile.
    – muru
    Nov 27, 2015 at 4:12
  • I don't want to know set TERM to dumb when I invoke gnome terminals. I'm learning linux/Unix and just confused that I can't find the point TERM variable is changed when or until gnome terminals are invoked.
    – cul8er
    Nov 27, 2015 at 4:23
  • 1
    It would be somewhere in the code of GNOME Terminal. It is a proper terminal emulator, unlike whichever program was using TERM=dumb. I'm not sure what you're asking here.
    – muru
    Nov 27, 2015 at 4:27
  • I don't complain TERM isn't dumb when gnome terminals are invoked. I'm a beginner and learning linux. There is a part that explains TERM in my textbook(Unix Power Tools), so I tried to check how the variable is used just for interest. So if its answer is "Gnome terminal set it", that's ok to me. But I wanted to get a bit more concrete answer if it's possible, maybe because I'm a programmer and curious about issues like this.
    – cul8er
    Nov 27, 2015 at 4:48
  • If you're a programmer, have you tried using the source?
    – muru
    Nov 27, 2015 at 4:50

1 Answer 1

2

The value dumb that you're seeing is probably set by systemd for LightDM (which sources .profile when you login, see /usr/sbin/lightdm-session).

The value xterm is set by GNOME Terminal, or, rather the VTE library that it uses. GNOME Terminal itself doesn't provide a way to change the setting, unlike other VTE-based terminals like XFCE Terminal. See src/pty.c:

/**
 * VtePty:term:
 *
 * The value to set for the TERM environment variable just after
 * forking.
 *
 * Since: 0.26
 */
g_object_class_install_property
        (object_class,
         PROP_TERM,
         g_param_spec_string ("term", NULL, NULL,
                              "xterm",
                              G_PARAM_READWRITE |
                              G_PARAM_STATIC_STRINGS));

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .