#!/bin/sh showtime=20 filter= if [ $# -gt 0 ] then showtime=$1 [ "$2" ] && { filter="grep \"$2\"" } else echo "Connection track will be shown $showtime seconds" echo "Run the script with an elapse time (seconds) argument" sleep 2 fi if [ "$filter" ] then cmd="cat /proc/net/ip_conntrack | $filter" else cmd="cat /proc/net/ip_conntrack" fi for i in $showtime do while [ $i -gt 0 ] do clear eval $cmd sleep 1 i=`expr $i - 1` done done exit 0