I wanted a way to run a single command and then have a menu of sorts to resume a particular screen session. I name mine with -S for the particular task at hand and often keep them running for months at a time. Every morning it was a PITA to have to do a screen -ls and then copy/paste the session I wanted to resume. This bit of code makes a bunch of aliases(1, 2, etc) that correspond to a particular session to make it ez to resume any particular one. Put it in your .bashrc, run scn and enjoy!
function scns() {
screens=`screen -ls | grep Detached | awk {'print $1'}`
counter=1
if [ -f /tmp/$USER-screens ]; then
rm /tmp/$USER-screens
fi
for screen in $screens; do
echo "$counter $screen"
echo "alias $counter=\"screen -r $screen -x\"" >> /tmp/$USER-screens
let counter++
done
}
alias scn='scns; source /tmp/$USER-screens'