3

I'm having issues where when I'm in a regular SSH terminal, with $TERM set to xterm-256color, and the terminal width is very small (narrow) in Linux Screen. I'm running Arch Linux. When I'm in the default SSH terminal (detached from a screen session), then my terminal width is fine, it goes all the way across. However, when I initiate screen, my terminal width narrows by a lot, and all my files are either wrapped or truncated. It goes from about 1400 columns to 80 columns; it's pretty bad. Any ideas to how to have it work in screen the way it works in the regular terminal? I'm not able to use screen the way I need to until I get this resolved.

2 Answers 2

1

I'm not sure what the problem is. I thought I'd let you know about dtach:

dtach is a program that emulates the detach feature of screen. It is designed to be transparent and un-intrusive; it avoids interpreting the input and output between attached terminals and the program under its control. Consequently, it works best with full-screen applications such as emacs.

dtach is intended for users who want the detach feature of screen without the other overhead of screen. It is tiny, does not use many libraries, and stays out of the way as much as possible.

I use it all the time. Screen is overkill for me. Sounds like it might work for you as well.

EDIT: usage example

Here is what I do for switching. It might be too much hassle for you. Though maybe you could make some aliases in your bash rc file. dtach works with socket files. So first I:

# dtach -A firsttask bash

Then start whatever task in the bash shell. Then leave it that dtach "session"

Ctrl-\

Start another dtach session:

# dtach -A secondtask bash

Using -A rather than -a will create the socket if it does not exist. If it does exist, it will not execute the specified command, just connect.

So if you want a set up with certain tasks that you always do, like you describe, it is possible. Bash aliases will make this convenient. You'll have one key stroke (Ctrl-\) to disconnect, and then an alias to connect. So a few more key strokes than screen.

You could make an alias for

alias log='dtach -A tailtask tail -f /var/log/messages'

in your .bashrc file and then just punch in 'log' and hit enter. If you dtach, it keeps running.

I just like dtach because it is small and I thought it was so cool how I can connect to the same socket twice. This means I can do "online" nix training for my friends who want to use the "new cool ubuntu thing". :P You can probably do something similar with screen I guess.

5
  • Man, this is sweet, but it unfortunately isn't going to work for me as a solution. I'm needing the functionality of screen in regards to switches between two or more windows. Reason being is I'm going to have a tail -f running in one screen and vim pulled up with source code in another, and possibly an FTP or some sort of remote connection in the third window for uploading/pulling remote files. Jul 8, 2010 at 22:36
  • Well, here is how I achieve that. It may be to much hassle for you though. Dtach works with socket files. So I do something like... Well, I'll add this to my answer since it has nice formating.
    – d-_-b
    Jul 9, 2010 at 4:44
  • +1 for an interesting and useful solution. However, what's the overhead of screen that we're avoiding? I never knew that screen was that heavy.
    – tylerl
    Jul 9, 2010 at 5:55
  • Well, obviously he was having other issues - nothing to do with overhead. I was quoting the man page. dtach is 18760 bytes and screen is 376112 bytes on the machine I'm typing on right now. For me, not an issue really. Just a preference. For embedded or virtual machines, it can be nice to only have a very lean set of tools. So small, dtach is on my list of tools to install.
    – d-_-b
    Jul 9, 2010 at 14:52
  • not an answer. downvoted and adding bounty, same thing happens to me :/ Apr 13, 2013 at 7:59
2

As per https://superuser.com/questions/217066/prevent-gnu-screen-from-resizing-display-size

Try adding this (from /etc/screenrc) to your ~/.screenrc:

# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E>
# (This fixes the "Aborted because of window size change" konsole symptoms found
#  in bug #134198)
termcapinfo xterm* 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'

You may need to change the "xterm" to match your $TERM.

1
  • This 13-year-old question was still amazingly relevant, and this is the working solution. Thank you Joshua :)
    – Mojo
    Mar 11 at 22:18

You must log in to answer this question.

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