Skip to content

Instantly share code, notes, and snippets.

@paulgb
Created May 7, 2014 19:32
Show Gist options
  • Save paulgb/81877713c6512ffae5f3 to your computer and use it in GitHub Desktop.
Save paulgb/81877713c6512ffae5f3 to your computer and use it in GitHub Desktop.
Bash function for managing remote screen sessions
# replace all instances of "servername" with the remote host name
# `servername` lists available screen sessions
# `servername <session>` connects to a given session
function servername {
if [ -n "$1" ]; then
ssh -t servername "screen -DR $1";
else
echo "Usage: servername [environment]";
echo "Open sessions:"
ssh -t servername "screen -ls";
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment