#!/bin/bash

# show remote hosts using the local X11 server
ss -trH state established '( sport = :x11 )' "not dst $HOSTNAME"|awk -F'[ :]*' '{print $5}'|sort|uniq -c|sort -nr|while read count host; do
  printf '%s (%d connections)\n' "$host" "$count"
done
