Skip to content

Instantly share code, notes, and snippets.

@cr0cK
Created December 1, 2023 18:49
Show Gist options
  • Save cr0cK/1e5914530b1fce142ee9d47b027c7a27 to your computer and use it in GitHub Desktop.
Save cr0cK/1e5914530b1fce142ee9d47b027c7a27 to your computer and use it in GitHub Desktop.
Reattach detached screens
#!/bin/bash
# Get all detached screen sessions
SESSIONS=$(screen -ls | grep Detached | awk '{print $1}')
# Check if there are any detached sessions
if [ -z "$SESSIONS" ]; then
echo "No detached screen sessions found."
exit 0
fi
# Open each session in a new GNOME Terminal window
for SESSION in $SESSIONS
do
gnome-terminal -- screen -r $SESSION &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment