I frequently use ssh on my MacBook to connect to other servers and run long-running commands there. When I do this, I leave the lid open to let it run, but then if I don't go to make coffee or something, it automatically turns the screen off, and this also causes the ssh to disconnect.
I tried to find how to prevent this automatically in the Terminal settings and in power saving settings, and couldn't find anything relevant. To prevent this disconnection I play a video silently, and this doesn't let power saving turn the screen off, but this is weird and lame to begin with, and if I forget to do this, then my session is lost. Is there anything better and more automatic?
screen
/tmux
or undernohup
. It is useful and more fail-proof to network problems too.