Flushing the DNS Cache in OS X and Linux

In Leopard do:

sudo dscacheutil -flushcache

In Linux (Ubuntu):

sudo /etc/init.d/nscd restart

Update:

In OS X Yosemite:

sudo discoveryutil mdnsflushcache
In OS X Mavericks, Lion, Mountain Lion:

sudo killall -HUP mDNSResponder
Written on March 11, 2009