Skip to content

Instantly share code, notes, and snippets.

@awalon
Forked from FreedomBen/digall.sh
Last active February 17, 2026 15:10
Show Gist options
  • Select an option

  • Save awalon/ffe40b2de8b60b4135ea91fde6a20c0a to your computer and use it in GitHub Desktop.

Select an option

Save awalon/ffe40b2de8b60b4135ea91fde6a20c0a to your computer and use it in GitHub Desktop.
A bash command that will run a `dig` against a specified target for all record types
#!/usr/bin/env bash
#
# To use, simply run `digall <domain>` such as:
#
# digall example.com
# digall sub.example.com
#
# Place this file in your PATH. Suggest either /usr/local/bin/ or ~/bin
#
# Alternatively you can wrap it in a function called `digall` and put in ~/.bashrc
#
# License: MIT
declare -rx digall_color_restore='\033[0m'
declare -rx digall_color_red='\033[0;31m'
declare -rx digall_color_light_green='\033[1;32m'
declare -rx digall_color_light_blue='\033[1;34m'
declare -rx digall_color_light_cyan='\033[1;36m'
if [ -z "$1" ]; then
echo -e "${digall_color_red}Error: Please pass domain as first arg${digall_color_restore}"
else
echo -e "${digall_color_light_blue}Queries: (dig +noall +answer '$1' '<type>')...${digall_color_light_cyan}\n"
declare -x dns_types='SOA NS SPF TXT MX AAAA A'
[ -n "$(dig +noall '$1' CNAME)" ] || declare -x dns_types='AAAA A' # CNAME detected skip all but AAAA and A
for t in $dns_types; do
printf "${digall_color_light_green}Querying for %-4s records...${digall_color_restore}${digall_color_light_cyan}\n" "$t"
dig +noall +answer "$1" "${t}"
echo -e "${digall_color_restore}"
done
fi
@awalon
Copy link
Author

awalon commented Feb 15, 2026

CNAME and "column"- mode for DNS types added.

Install with (ex.):

wget -qO - https://gist.githubusercontent.com/awalon/ffe40b2de8b60b4135ea91fde6a20c0a/raw/8862d541884be3e7222bd516a55f309d68b783a8/digall.sh | sudo dd of=/usr/local/bin/digall && sudo chmod +x /usr/local/bin/digall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment