You can, but you will need some extra utilities:
brightness - you can download the program at http://dev.sabi.net/svn/dev/trunk/LocationDo/brightness.c and compile it using the command:
gcc -std=c99 -o brightness brightness.c -framework IOKit -framework ApplicationServices
Or you can just download it from my server at http://attic.luo.ma/brightness.bz2
Once you have it, brightness 0.01
will lower the brightness as much as possible
Bluetooth - The command you want is blueutil
which you can find here https://github.com/toy/blueutil. I have a compiled version of that available at http://attic.luo.ma/blueutil2.bz2. I also have another, older version of a program by the same name which you can download from http://attic.luo.ma/blueutil.bz2.
Whichever program you use, the -h
flag will explain how to use it.
Wi-Fi - You can turn AirPort power on or off using:
networksetup -setairportpower <device name> <on off>
where <device name>
is probably either en0 or en1
You can find out which it is using
networksetup -listnetworkserviceorder | egrep "Wi-Fi, Device"
For my MacBook Air (which uses en0), the command to turn it off is:
networksetup -setairportpower en0 off
More Settings
Be sure that you have changed the Energy Settings in System Preferences too, but you can also set them using:
sudo pmset -b sleep 10
to tell the computer to sleep after 10 minutes when on battery, and/or:
sudo pmset -b displaysleep 5
to tell the computer display to sleep after 5 minutes, when on battery (the -b flag indicates battery).
pmset -g
will show you your current settings.
On the Mac, dia
(specifically /Applications/Dia.app/Content/Resources/bin/dia
) is just a shell script wrapper to the compiled dia-bin
binary. It sets a number of environmental variables, and then finishes by executing Dia as a GUI:
exec "$CWD/dia-bin" --integrated
You can make a copy (e.g. cp -p dia dia-cmd
) and edit that last line in dia-cmd
to become:
"$CWD/dia-bin" $@
and then you can use it as dia-cmd
within the terminal.
Note: I found that for my locale (en_US.UTF-8), at least, running dia-cmd
in the terminal was way too chatty about trying to determine the correct locale, spewing ignorable warnings:
Warning: AppleCollationOrder setting not found, using AppleLocale.
Setting Language: en.UTF8
(process:33043): Gdk-WARNING **: locale not supported by C library
(process:33043): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
You can eliminate that by also commenting-out those lines in dia-cmd
, and manually forcing the correct locale:
## LANGSTR=`defaults read .GlobalPreferences AppleCollationOrder 2>/dev/null`
## if [ "x$LANGSTR" == "x" ]
## then
## echo "Warning: AppleCollationOrder setting not found, using AppleLocale." 1>&2
## LANGSTR=`defaults read .GlobalPreferences AppleLocale 2>/dev/null | \
## sed 's/_.*//'`
## fi
# NOTE: Have to add ".UTF-8" to the LANG since omitting causes Dia
# to crash on startup in locale_from_utf8().
## export LANG="$LANGSTR.UTF8"
export LANG="en_US.UTF-8"
## echo "Setting Language: $LANG" 1>&2
Voila:
MYMACHINE:~ lars$ /Applications/Dia.app/Contents/Resources/bin/dia-cmd -v
Dia version 0.97.2, compiled 18:51:13 Mar 17 2012
Best Answer
The pmset command has much shorter output than system_profiler:
The first line on my MacBook says "Now drawing from ..." either "AC Power" or "Battery Power" when it runs.