Killing all your VNC sessions at once

#!/bin/bash

SESSIONS_NO=`vncserver -list | grep "^:" | tr '\t' ' ' | cut -f1 -d' ' | wc -l`

if [[ $SESSIONS_NO -ne 0 ]]; then
  for no in $(vncserver -list | grep "^:" | tr '\t' ' ' | cut -f1 -d' '); do
    vncserver -kill $no
  done
else
  echo "There are no running VNC sessions for user: $USER"
fi