Here are few examples of how to use dig from within SSH to query a nameserver:
dig domain.com @NS2.hostname.COM mx
This will query or ask ns2.hostname.com what the mx record is for domain.com
dig domain.com @NS2.hostname.COM
If you remove the mx it will simply reply with the A record for domain.com