You are not logged in.

#1 2013-11-15 16:48:39

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Is setting TERM=xterm enough?

Hello everyone,

I was having some troubles with that variable environment, for example, I got  "unknown terminal type linux" by nano when I was in a TTY. I took care of it exporting variable TERM with xterm in my .bashrc.
Now I can use nano in a TTY again. I think it was not enough though, indeed I still get

"shell clear'XTERM': unknown terminal type."

when debugging with gdb.
Is just exporting the TERM variable environment enough to get it work or anything else is needed?

Thanks for reading.

Last edited by Grant (2013-11-15 16:51:58)

Offline

#2 2013-11-15 16:53:40

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Is setting TERM=xterm enough?

Do you mean tty as in 'outside of X'?Have you tried lowercase 'xterm'?

Last edited by karol (2013-11-15 16:54:31)

Offline

#3 2013-11-15 16:58:40

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: Is setting TERM=xterm enough?

By gdb = inside X
By nano = outside X
However, lowercase xterm doesn't work.

Offline

#4 2013-11-15 16:59:54

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: Is setting TERM=xterm enough?

This is my .bashrc:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

#begin ALIAS
alias ls='ls --color=auto'
alias reb='systemctl reboot'
alias off='systemctl poweroff'
alias sus='systemctl suspend'
#end ALIAS

PS1='\[\e[01;36m\]\u@\[\e[1;36m\]\h \W\$\[\e[m\] '

#begin export
export TERM=xterm
#end export

Offline

#5 2013-11-15 17:01:03

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Is setting TERM=xterm enough?

xterm ix an X terminal emulator, it doesn't work outside of X, neither will setting term type to xterm make your tty happy.

Offline

#6 2013-11-15 18:22:19

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Is setting TERM=xterm enough?

I don't think you need to be manually setting $TERM at all.  You should remove that and let the system figure out what it needs at any given point.  The TTY/console uses TERM=linux, and setting that variable to an Xorg dependent terminal emulator is sure to cause you issues.

The one exception where setting $TERM manually might be necessary is if you are remotely logging into a machine.  When I ssh into my home headless file server, it doesn't like that my $TERM variable is set to xterm-termite, so I have to fix this in my zshrc.

Offline

#7 2013-11-16 13:05:07

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: Is setting TERM=xterm enough?

Then which could be the solution?
I would like to know why I get that problem, maybe what has changed, because before I have never come across it.

Offline

#8 2013-11-16 13:58:11

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Is setting TERM=xterm enough?

Here is what I use, in ~/.bashrc:

if [[ -n $SSH_CONNECTION ]] ; then
    export TERM=linux
elif [[ $COLORTERM == xfce4-terminal ]] ; then
    # http://vim.wikia.com/wiki/256_colors_in_vim
    export TERM=gnome-256color
    # http://pkgs.fedoraproject.org/cgit/coreutils.git/tree/
    eval `dircolors --sh "/etc/DIR_COLORS.256color"`
else
    export TERM=linux
    eval `dircolors`
fi

Offline

#9 2013-11-16 14:06:05

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: Is setting TERM=xterm enough?

$TERM sets the 'terminfo' file that the console or the terminal emulator will use to translate keystrokes and escape sequences into glyphs and actions.  By setting TERM=xterm you'll confuse your terminal programs.

Do you still have the problem if you start nano with this command?

$ TERM=linux nano <somefile>

Offline

#10 2013-11-16 14:11:30

Grant
Member
From: Italy
Registered: 2012-12-15
Posts: 246

Re: Is setting TERM=xterm enough?

thisoldman wrote:

$TERM sets the 'terminfo' file that the console or the terminal emulator will use to translate keystrokes and escape sequences into glyphs and actions.  By setting TERM=xterm you'll confuse your terminal programs.

Do you still have the problem if you start nano with this command?

$ TERM=linux nano <somefile>

Yes, I do both inside and outside X.

Offline

#11 2013-11-16 14:20:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Is setting TERM=xterm enough?

With respect to all those above, I have to disagree with most of these suggestions.  Perhaps with the exception of cases like ssh sessions, TERM variables should never be set manually (unless as a one-off diagnostic test).

In a tty TERM should be "linux".  Nano works fine with this.  If it doesn't on your end, you should not try to cover the problem with metaphorical duct tape, but instead figure out what the real problem is and fix it.

Some relevant diagnostics:

pacman -Qs ncurses
ls /usr/share/terminfo/l

Last edited by Trilby (2013-11-16 14:21:26)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB