Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using a normal bash prompt echo -e 'hello\tworld' produces a real tab. However the same command run within GNU screen puts spaces between the two words.

I have tested this on Ubuntu 10.04 with Screen version 4.00.03jw4 (FAU) 2-May-06 and RHEL 5.5 with Screen version 4.00.03 (FAU) 23-Oct-06

Is there a way to have screen output tab characters instead of converting them to spaces?

share|improve this question
up vote 0 down vote accepted

No, there is no way, short of writing code. Have a look at the man page under "BUGS:"

  • Screen does not make use of hardware tabs.

Hardware, in my case, is the software "gnome-terminal."

share|improve this answer
I also get the same behavior in tmux. I wonder if this is a difficult problem to solve. – phylae Jun 9 '11 at 7:19

This simple experiment, inside GNU Screen, shows me that "\t" is outputting a TAB character (NOTE: You were missing an "-e" flag to your echo command):

skx@birthday:~$ echo -e "Hello\tWorld" | od -c
0000000   H   e   l   l   o  \t   W   o   r   l   d  \n

Now I repeat that command and save the output to a file, verifying that there is a TAB character still present:

skx@birthday:~$ echo -e "Hello\tWorld" > x
skx@birthday:~$ od -c < x
0000000   H   e   l   l   o  \t   W   o   r   l   d  \n

BUT if I cat that file, and copy and paste, via my mouse, into emacs the TAB is lost. So it seems like the parent gnome-terminal is doing something odd, or the tab is converted when pasted into my new window. Either way I suspect GNU Screen isn't to blame.

share|improve this answer
Using emacs to try to understand the behavior of tabs in screen is like using...err...something even more complicated than the thing you're trying to examine. There are heaps o' pages explaining the complex way emacs handles tabs. Even jwz has a page on it – Mark Wagner Jun 7 '11 at 22:42
I know Emacs, I use Emacs, if you don't understand Emacs then please use your preferred editor. (FWIW: I tested with gedit, vim, and nano. Same result in each case.) – Steve Kemp Jun 7 '11 at 22:48
Wow, it was a joke. – Mark Wagner Jun 7 '11 at 22:55
It could be something to do with both gnome-terminal (I tried versions 2.30.2 and 3.0.1) and screen together, it can't be just gnome-terminal because it "works" when I don't use screen. Also when I use screen's copy mode (CRTL+A ESC), highlight the output (arrow keys, then SPACE, then arrow keys), and write out the output to the screen's temp file buffer, it sees it as spaces. – phylae Jun 9 '11 at 7:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.