Checking for idleness from the commandline

I was looking for some way to tell if a remote machine was idle from the commandline and I stumbled across this snippet on Mac OS X Hints.

ioreg -c IOHIDSystem | awk ‘/HIDIdleTime/ {print $NF/1000000000; exit}’

returns a time in seconds and fractions thereof, ie 4.00711

Airport commandline utility

If you need to connect to an airport wireless network from the commandline you could check out the little known airport command line utility.

It’s hidden at
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport

You can use –help for help and -I for signal strength and ID info