How to restart only the graphical side of OS X via Terminal

I have a variety of mac minis that I use to display stats and system status. Sometimes the Safari browser that is displaying the stats graphs on those remote mac minis locks up / runs out of memory. This makes using Remote Desktop to restart the remote Safari session impossible as I can't login to the machine. Rather than walk over to force a reboot I can ssh into the box and restart the WindowsServer (WindowsServer is the graphical user interface manager and is typically the thing that is borked). 

To resolve this issue I ssh into the machine via Terminal and then run the following command:

sudo killall -HUP WindowServer

Any open applications will be forced to close so use the command with caution.

How to unpack a .deb file on Mac OS X without installing it

If you use Xcode, a utility called ar is installed. You can run the following command:

ar -x path/to/filename.deb

If you don't use Xcode, you could also install ar using Homebrew and run the same command.

Alternatively, you could use Homebrew to install the dpkg utility which has many more options to work against .deb files.

dpkg -c path/to/filename.deb

How to Create Symbolic Links at the Command Line of Mac OS X

If you want to create and set a symbolic link at the command line in OS X, you will need to use the ln command with the -s flag (if you don't use the -s flag a hard link is set). You'll need to launch a terminal session in order to follow along.

How to Create a Symbolic Link

Here is the syntax for creating a symbolic link:

ln -s /path/to/original_file /path/to/symlink_file

After running this command the symlink will point to the original location. Depending on which directory you are setting up the link in you may need to sudo:

sudo ln -s /path/to/original_file /path/to/symlink_file

How to Remove a Symbolic Link

rm is your friend => but use it wisely:

rm /path/to/symlink_file

You can also use unlink:

unlink /path/to/symlink_file