# A shell script to build dnstop utility to displays various tables 
# of DNS traffic on your network including bind 9 server stats.
# -------------------------------------------------------------------------
# Tested under CentOS / RHEL / Fedora Linux only.
# -------------------------------------------------------------------------
# Copyright (c) 2008 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# Last updated on Mar/05/2010
# -------------------------------------------------------------------------
# Home page: http://dns.measurement-factory.com/tools/dnstop/
[[ "$2" != "" ]] && ETH="$2"
[[ `id -u` -ne 0 ]] && { echo "$0: You must be root user to run this script. Run it as 'sudo $0'"; exit 1; }
case "$1" in
        wget $URL -O "${DLHOME}/$FILE"
        echo "Building ${SOFTWARE}...."
        # this needs some improvements, bur right now I am just gonna try to install it ;( 
	yum -y install libpcap-devel ncurses-devel &>/dev/null
        [[ ! -f "${DLHOME}/$FILE" ]] &&  wget $URL -O "${DLHOME}/$FILE"
        cd "${DLHOME}"
        tar -zxvf $FILE
        cd "$DEST"
        make install
        grep -q 'alias dnstop' $HOME/.bashrc        
        [ $? -ne 0 ] && echo "alias dnstop='/usr/local/bin/dnstop -l 6 ${ETH}'" >> $HOME/.bashrc
    *) echo "Usage: $0 {download|build} [eth0|eth1]"


From the man page:

dnstop is a small tool to listen on device or to parse the file savefile and collect and print statistics on the local network’s DNS traffic. You must have read access to /dev/bpf*.

How Do I Use This Script?

Download type the following command:
./script.sh build
/usr/local/bin/dnstop -l 6 eth0

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source, and DevOps topics via:
Category List of Unix and Linux commands
Disk space analyzers ncdu pydf
File Management cat
Firewall Alpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilities NetHogs dig host ip nmap
OpenVPN CentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Manager apk apt
Processes Management bg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searching grep whereis which
User Information groups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPN Alpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • Indie May 20, 2011 @ 0:24

    For Ubuntu you can simply do

    sudo apt-get install dnstop
  • Alex Apr 28, 2011 @ 8:43

    The script surely would work only on rpm-based Linuxes, as it uses the “yum” command.
    Maybe if you changed this one line to equivalent apt command…?

  • oussama larhmich Sep 6, 2010 @ 10:44


    thinks for this articles but,will it work in Ubuntu Server ??

  • vivek Mar 24, 2010 @ 8:44

    Tthis article is nic, will it work in debian & use linux?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.