Tag Archives: os x

Using dig to Query a Specific DNS Server (Name Server) Directly (Linux, BSD, OSX)

There may be occasions when you wish to query a DNS server directly.  I often do it before changing DNS servers for a domain; I’ll setup the new records on the new DNS servers, and then query them directly to ensure they are returning the correct records.

I recommend that anyone running DNS services for any domain looks into these commands – they’re very useful, especially when you’re making changes.

dig has a feature which allows you to specify a name server along with the record you want to query.

For example, one of the DNS servers for droptips.com is “ns.123-reg.co.uk”.  We can query this server directly, for the www record by doing the following:

$ dig droptips.com @ns.123-reg.co.uk

You’ll get some output with a section titled Answer Section:

 droptips.com.       86400   IN      A

This details the result ( and also the TTL for the record (in seconds).  The TTL is important, as this is how long caching DNS servers should cache the result for – in this case, 86400 seconds which is 1 day. Using this command to find out a TTL value for a particular record is also quite useful, especially if you’re investigating DNS cache issues.

You can also do the same to check other records such as MX records, by simpling adding the record type to the command.  For example, to get the MX records ns1.google.com is reporting for google.co.uk:

$ dig MX google.co.uk @ns1.google.com

… with the results:

 google.co.uk.           10800   IN      MX      10 google.com.s9a2.psmtp.com.
 google.co.uk.           10800   IN      MX      10 google.com.s9b1.psmtp.com.
 google.co.uk.           10800   IN      MX      10 google.com.s9b2.psmtp.com.
 google.co.uk.           10800   IN      MX      10 google.com.s9a1.psmtp.com.

You can see in this instance, that the TTL is 10800 seconds which is 3 hours, and all MX records have the same priority level of 10.

Checking the Uptime of your OS X Machine

Uptime, uptime, uptime.  Everyone loves massive uptime, right?

The “Who’s PC has been on the longest without a reboot?” sort of challenges.

Well, finding out the uptime on an OS X machine is quite easy!

If you open a Terminal (by using Spotlight, then searching for Terminal or open Applications/Utilities and double click Terminal) and then type:


… so it looks something like this:

user@mac:~$ uptime
23:46  up 11:55, 3 users, load averages: 0.17 0.21 0.23

There is multiple parts of information from this command.  The part we’re focusing on is the second part:  “up  11:55”.  This means that the machine I’m currently on has been booted up for 11 hours and 55 minutes.

So, what’s your uptime?  How often do you manually restart your computer?  Let me know via comments below!

How to Stop .DS_Store From Being Created on Network Drives (OS X)

.DS_Store files can make even the tidiest network shares look horrible to none-OS X users.

Whenever an OS X machine accesses a network share, it creates a .DS_Store file for it’s own use (on SMB/CIFS, AFP, NFS, and WebDAV servers).  These files are invisible to the OS X user, but will show up to anyone else using other operating systems such as Windows or a Linux distribution.

Turning them off is easy though, by running the following command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

You will need to either log off or restart the computer for the changes to take affect.

For more information, please see the official knowledge base article here:  http://support.apple.com/kb/HT1629