![](https://seccdn.libravatar.org/avatar/24ca8608248a11f8eeb5fa02a0d5c463.jpg?s=120&d=mm&r=g)
Robert wrote regarding 'Re: [SLE] Setting console tab width' on Mon, Sep 13 at 13:36:
dsauer@danny-pc:~> setterm -regtabs 4 dsauer@danny-pc:~> echo -e 'moo\tmoo\nm\tmoo' moo moo m moo
Thanks a lot for the help!
Your result surprised me. I went back and checked it on console. 'setterm -regtabs' does work on linux virtual terminals. It doesn't normally work in KDE's konsole, xterm, or rxvt. However, it works for those terminals if I first 'setenv TERM linux' instead of leaving it set to 'xterm'. Is there a different way of setting displayed tab width for the 'xterm' terminal type? Google has been less helpful than usual on this.
Well, I looked at /etc/termcap and noticed that there's a line that says it#8 somewhere for most terminals. I'm willing to bet that you could change that file with, say, perl: perl -pi.bak -e's/it#8/it#4/' /etc/termcap you'll have /etc/termcap.bak as a backup if this screws things up... I dunno if that'll help or not, but it's possible. :)
That's on a 9.1 workstation, but it works the same on a 7.1 system, so I'd expect it to work for you. It's limited to the terminal's output, though, and won't neccesarily work inside other programs that handle the terminal directly. So, if you fire up vim or even less, it won't work as well. It'll work through "more", though. You probably need to set your tabstops per application if you want something other than the huge 8 spaces commonly used.
I set it in the configuration files for those editors. My main problems are direct output, cat, and tee. It looks like I need to find a way to set tab width for 'xterm's. I guess I could also tell my terminals that they are 'linux' terminals. However, I'm afraid that might have side effects.
I've been setting my terminal string to linux for a while now, and it works fine for most everything but a few older programs that don't get that "linux" is a color terminal. They just default to something like vt100 or similar. --Danny