Linux – Terminal Width issues with Linux Screen

arch-linuxgnu-screenlinuxsshterminal

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.

Best Answer

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.

Related Topic