Archive for October, 2007
DNS cache in Leopard|Mavericks|Yosemite
Here is the best summary from http://coolestguidesontheplanet.com/clear-the-local-dns-cache-in-osx/:
For Yosemite the command is
-
sudo discoveryutil udnsflushcaches
For Mavericks, the commands are
-
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
For Lion & Mountain Lion the commands are
-
sudo killall -HUP mDNSResponder
For Leopard & Snow Leopard the commands are
-
sudo dscacheutil -flushcache
It looks like the dscacheutil is going to be a handy utility for web developing. Woohoo!
Update: Another useful thing is how to restart remote desktop from a command line:
-
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent -console -menu
Remember that, too.
Update II (2008-06-14 12:42 p.m.): Another useful thing is how to restart MySQL (or other startup programs) from a command line:
-
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
-
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
Update III (2011-09-14 19:27:57): Another useful thing is now to compute directory usage from the command line. The syntax is a little different for OS X than other *nix-based languages. To display the usage of all subdirectories below the current directory (“-d 1” means depth of one):
-
du -h -d 1 ./
I upgraded my Mac to Leopard yesterday and it is a beautiful operating system. My silver G5 runs fairly well, but bootup is considerably slower now. I was making some network changes today and had the need to flush my Mac’s DNS cache but had a hard time finding out how (without having to reboot, that is.)
After some frustrating searches (no, there is no lookupd command in Leopard) I finally found the answer thanks to ITToolbox.
CatOS Config
I have been beating my head against the wall for an hour now and finally figured out the answer so I have to document it here. (This has everything to do with my OCD-ness.) When you are editing a Cisco Catalyst config (running CatOS) sometimes you make a mistake in the port configuration and you want to return it to a completely unconfigured state. Unfortunately, CatOS likes to keep remnants of the commands you have entered and it is hard to get rid of those parts, especially the trunking commands. For example, if you change the trunking state of a port then want to return it to an unconfigured mode, it might keep something like:
-
clear trunk <mod>/<port> 1-4094
in the configuration. For the OCD in me, this drives me nuts. I want it to say nothing about the port. The way to remove or delete the “clear trunk” part from your CatOS config, you must enter the following command:
-
set trunk <mod>/<port> auto negotiate 1-4094
This should remove all traces of port trunking configuration from your config file.