I have several linux servers to work every day, and I have a GNU screen session for each of them to keep things going.
The question is that I am so tired of the question screen -Rd workevery time I log in, is there a way to get rid of this? Or any workarounds?
Reading @Sami's answer, I did some search in the shell variable $STYand found this:
STY: alternate socket name. If the screen is called and the STY environment variable is set, it only creates a window in a session of a work session, and does not start a new session.
So, I think the key is a variable $STY, we can add it to .bashrc or .profile if it is executed after login. Thanks @Sami
source
share