Posts Tagged ‘ mac os x

How to Flush DNS Cache on Apple Mac

Every Mac caches resolved DNS queries. Sometimes you get entries which create problems. To get rid of them you have to options: reboot the machine. This is the bad one. The good one is: Type the following command in the Terminal:

dscacheutil -flushcache

Connect to a serial console with a Mac

Most network devices still got a serial console. If you got a Mac and want to connect to this console, get yourself a Serial-to-USB converter that is supported by Apple. A good one is the Keyspan usa-19hs. After you installed the driver, plug in the USB serial Adapter.

Now you could search and download some Terminal Software. But it is much easier. Use screen. screen is already built in. You have nothing to compile, nothing to add, just use it like this:

screen /dev/tty.Keyserial1 9600

When you finished your work just close screen with “ctrl-a k“.

Firmware upload with xmodem from a Mac

If you have to upload firmware to a router or a switch with xmodem, get the package lrzsz-0.12.20.tar.gz. Configure it with

tar xvzf lrzsz-0.12.20.tar.gz
cd lrzsz-0.12.20
./configure --disable-nls && sudo make install

Then start a console session with screen

screen /dev/tty.Keyserial1 9600

then, when you are asked from the program up upload the firmware using xmodem, do:

Press ctrl-a
:exec !! lsx -b -X /path/srw2016-24-10086.ros

the upload will start.

Calculate File Checksums with openssl

If you need to calculate the checksum of a file on Mac or UNIX simply use openssl:

openssl md5 DeleteCookies.zip
openssl sha DeleteCookies.zip

This command gives you the checksum of the file as a result.

Using chmod

chmod is the tool to change the permission on UNIX based systems.

For the options consult wikipedia.

Why is it worth to mention it here? If you change the permissions recusively ofer a directory tree, usually you do not have the right permissions for directories and for regular files.

You can avoid that by using find, as shown in the example:

find . -type d -print | xargs chmod 755
find . -type f -print | xargs chmod 644

Type “d” applies the change to directories, whereas type “f” applies it to files. find “.” means to all files starting in the current directory.