News for hackers. Stuff that matters.
Re:GNU Screen 5.0 Released by throw0101d on Thursday August 29, 2024 @10:37AM (#41391248)
To anyone to perhaps who has used both a lot:

* Are there particular pros and cons to using screen or tmux?

(I'm generally on macOS for work, but never really go into using iTerm2, so that integration isn't a big thing for me personally.)

Edit: I mean why use one over the other. I generally use something on the destination host I'm SSHing to in case the network goes sideways.

Re:GNU Screen 5.0 Released by pwg on Thursday August 29, 2024 @10:49AM (#41391372)
> Are there particular pros and cont to using screen or tmux

If you mean vs. not using screen or tmux, the pros to using (among many) are:

1) you get plural terminals in one "window" (xterm, remote ssh session, etc.) that you can switch between with hot-keys. This has a larger advantage for remote ssh sessions, where one ssh connection can be used for plural remote terminals, than it does locally where you could simply launch a second xterm.

2) you gain the ability to 'disconnect' from the screen session (I presume tmux offers a similar feature). This works just like 'disconnect' from a RDP session. All your remote terminals remain active, open, and waiting. When you next ssh in, you simply 'reconnect' and everything is there just as you left it when you disconnected. This helps for both flaky connections where the link drops at times as well as the "done for the day" "disconnect".

3) for screen, there is a screen built in 'copy and paste' controlled by the screen hotkeys, so if you are in a situation where you have no local copy/paste (unlikely in 2024, much more likely back in the days of VT100's) you can still select and copy portions of the screen to a 'clipboard' for pasting into somewhere else. I don't know if tmux offers something similar.

4) screen also offers 'scrollback buffering' (it will retain the last X lines that scroll off the top of your viewport) and has a feature to let you "look back" at what just scrolled out of view. This is less useful in 2024 with xterms/urxvt's offering the same feature locally, but for a remote ssh connect this does give you 'scrollback' that is specific to each screen terminal you have open instead of all mixed up in the local viewer.

There's more advantages, but those are the big ones, and the 'disconnect/reconnect' one is huge if you use the terminal a lot and also often connect via ssh from remote locations.

Re:GNU Screen 5.0 Released by filloutform on Thursday August 29, 2024 @01:15PM (#41393067)
tmux does all that
Re:GNU Screen 5.0 Released by kstrauser on Thursday August 29, 2024 @10:43AM (#41391315)
In that case, try Zellij. I gave it a shot the last time it made the rounds on HN and instantly loved it.

Killer feature: mouse scrolling works out of the box.

Re:GNU Screen 5.0 Released by sundarurfriend on Thursday August 29, 2024 @02:27PM (#41393858)
I loved Zellij, it was the first time a terminal multiplexer felt like it added significant value without significant work from me.

The only problem is that projects dealing with network stuff require aging just the way wines do. Networks are unreliable and can get into a thousand different states that are a combination of local connection issues, remote issues, input problems, etc etc. I found (when I tried it a year or two ago) that Zellij could handle a decent amount of such weird states, but not all of them. There was noticeably more "stuck" states it could get into.

It was a pleasure to use in every other way, and maybe this has become much less of a problem in the intervening time. I'm pretty sure that Zellij is going to be my one true term mux for the future, just not sure that future has started yet.

Re:GNU Screen 5.0 Released by kstrauser on Thursday August 29, 2024 @03:36PM (#41394513)
I've used tmux for ages and would go back if zellij ceased to exist, but I found zellij so much more discoverable. Want to do something new? Chances are there's a menu for it.
Re:GNU Screen 5.0 Released by Izkata on Thursday August 29, 2024 @11:24AM (#41391770)
One advantage of knowing screen, it's likely already installed on whatever remote machine you're connecting to.
Re:GNU Screen 5.0 Released by throw0101d on Thursday August 29, 2024 @11:39AM (#41391965)
IIRC: RHEL9 no longer has screen (EPEL-only), and only has tmux.
Re:GNU Screen 5.0 Released by nolist_policy on Thursday August 29, 2024 @10:45AM (#41391334)
Screen can connect to serial ports.

  screen /dev/ttyUSB0 9600
Re:GNU Screen 5.0 Released by thiht on Thursday August 29, 2024 @10:56AM (#41391444)
What does it do exactly?
Re:GNU Screen 5.0 Released by pak9rabid on Thursday August 29, 2024 @11:23AM (#41391755)
It functions like a lightweight version of minicom (which is a terminal program), which when connected to the console port of many network appliance hardware devices (like switches, routers, access points, etc) allows local access to the device (much like having a monitor/keyboard/mouse connected to a computer) without having to rely on a network connection.
Re:GNU Screen 5.0 Released by d4rti on Thursday August 29, 2024 @11:05AM (#41391553)
It's been a while but I used this with a USB to serial and a console cable for accessing Cisco switches/routers console.
Re:GNU Screen 5.0 Released by WhatIsDukkha on Thursday August 29, 2024 @01:10PM (#41393021)
Tmux allows you to start multiple windows and send commands to them.

An example from man tmux -

"

refresh-client -t/dev/ttyp2

rename-session -tfirst newname

set-option -wt:0 monitor-activity on

new-window ; split-window -d

bind-key R source-file ~/.tmux.conf \; \ display-message "source-file done"

"

Screen has no equivalent besides manually using the keybinds.

I believe tmux has some better mechanics around the attach/detach but it eludes me atm what was better.

Basically what made me switch in the first place from screen to tmux was wanting a split window watch compile and a logfile to run automatically with one command.

Hard with screen and easy with tmux.

Re:GNU Screen 5.0 Released by rramadass on Thursday August 29, 2024 @11:16PM (#41397453)
Long ago i decided to train myself on a lightweight development environment available on all platforms so i can carry it around easily in my head. I came up with GNU Screen + dvtm tiling window manager(as needed within each screen window) + Vim (with Cscope + GNU Global/Ctags). I generally leave this running on a central server/my local desktop/laptop, connect from anywhere anytime (detach/reattach) and continue working. From this central screen session i can connect to various other machines (including embedded devices via serial/USB/Network) allocating one screen window running dvtm (allows me to run multiple shell sessions) to each machine. This keeps everything clean and nicely organized in my head thus allowing me to carry it to any needed platform.