HACKER Q&A
📣 tobwen

How to make `screen` behave like a native shell?


I've been using `GNU screen` as my primary terminal multiplexer for about 15 years. It allows me to run different sessions in the background and resume them. Although I'm aware of other tools like `tmux`, my muscle memory has kept me loyal to `screen`.

One thing that always frustrates me is that a screen environment doesn't feel like a normal shell session. For example, when I log in via SSH into Bash, I can scroll back almost infinitely, all shortcuts (like CTRL + arrow keys) are available, and there are no visual or audible bells.

Does anyone know a way to configure `screen` or `tmux` to behave exactly like a native shell session? Or is there another alternative that I'm not aware of?


  👤 tithe Accepted Answer ✓
There's a timely sub-thread about `tmux` going on here that might answer some of your questions: https://news.ycombinator.com/item?id=40598629

👤 timrichard
Do you use a Mac? If so, tmux in control mode [1] plus iTerm2 could be what you're looking for. You would use the -CC flag when starting tmux either locally or on a remote host.

This brings all the niceties of an iTerm shell session, but still allow you to detach from tmux and reattach at a later point whilst still using the native iTerm features. Almost indefinite scrollback, as you mentioned. Also good terminal search facilities, and features to filter text in the session to display only lines that contain a keyword. Instant Replay lets you drag a slider and replay old TUI output that may have been erased from the screen [2]. And the configurable hotkeys are useful for pane splitting, which I find to be more convenient than the leader-plus-command of tmux. I find the toolbelt window useful, and sometimes define snippets of long cumbersome commands where it isn't possible or maybe appropriate to define aliases on a remote host. For local tmux sessions, I like some of the features of the iTerm shell extensions, like jumping back to the points of previous commands entered, which helps navigate through large amounts of console output. Or the directory name picker based on frecency, which is useful for adding directory names when composing long commands or to jump to a directory when using Zsh (which lets you omit the 'cd' command).

[1] https://github.com/tmux/tmux/wiki/Control-Mode

[2] https://iterm2.com/features.html


👤 imvetri
Strip the computer part

How to make 'screen' behave.

Forget about the computer's underlying constructions.

programming languages are symbol based time waste.

In order to do something with programming, you need to know underlying api which talks to hardware resource. There are three hardware resource. display, space, time. Its monitor, cpu, and storage. but lets stick to fundamentals.

When trying to build using programming language brain effort gets consumed for obselete APIs. Reducing the underlying system, it boils down to display, space, time.

Display is the fixed size in hardware, so scratch it.

Whats left? space and time. Keep a dot on space, move your position forward. What happens? the point of dot is backward. When it comes to time, there are two point of observation. One within the space and another focusing on space.

Everypoint can be a point of reference to another point.

A point has a reference point, what if the reference point of the moving point also moves?


👤 atsaloli
You can increase the size of the scrollback buffer in GNU Screen. See the `scrollback` and `defscrollback` settings.

You can also disable bell: see https://stackoverflow.com/questions/23813869/how-do-i-comple...


👤 jaktet
I think it’s altscreen on that you want, you can see my base settings here https://github.com/jensbodal/shell-settings/blob/main/docs/s...

👤 M95D
Press CTRL-A, ESC and screen changes to selection mode. Use PGUP/PGDOWN to scroll. Press ESC to return to normal mode. Scroll buffer size is probably adjustable too.