Add applications to Exposé

You all probably know about Exposé’s Application Mode (introduced in 10.6 I think). What’s interesting is that while you’re in it, you can Command+click on other running applications and bring their windows into Exposé as well.
Steps to reproduce:

  • Open Application Exposé (click and hold on any running application in the Dock).
  • Cmd+click on another running application in the Dock.

What happens is that only the windows of these 2 applications will be shown in Exposé. You can also continue to Cmd+click on other applications and bring their windows into Exposé as well.

How to do Manual backups with Time Machine

Backing up manually with Time Machine is very easy, here’s how:
* Navigate and click on the Time Machine icon in the menubar
* Select “Back Up Now”

Time Machine will now begin a manual backup of your Mac’s hard drive. You can also just right-click on the time machine drive and select ‘Back Up Now’ to perform the same function, as seen in the screenshot above.

Only perform manual backups with Time Machine

If you want to backup manually only, all you need to do is disable the the automated backup process.
* Open System Preferences and click on “Time Machine”
* Switch Time Machine backups to ‘Off’ to disable automatic backups

Now the scheduled backup feature of Time Machine will be disabled, you can also choose whether to display the menubar icon through this System Preference.

Once automated backups have been disabled, to manually backup your Mac all you have to do is Right-Click on the Time Machine drive in the Finder and then select “Back Up Now” to start the backup process. You will need to do this anytime you want a backup. This can be easy to forget so for that reason I’d recommend just leaving the automatic backup feature on for most users.

Test wireless signal strength from the command line

If you’re trying to tweak a wireless router to get the best signal, being able to continuously measure the signal strength while you toy with the antennas, placement, and whatever else is really valuable.

To see a running tally of signal strength use the following command:
while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI; sleep 0.5; done

You’ll see something like ‘agrCtlRSSI: -38′ with the last number changing frequently, but printed repeatedly on your terminal screen. You can stop this command from refreshing by hitting Control+C.

To report just a single line with signal strength, use the following:
clear; while x=1; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep CtlRSSI | sed -e ’s/^.*://g’ | xargs -I SIGNAL printf "\rRSSI dBm: SIGNAL"; sleep 0.5; done

Again just hit Control+C to stop the command. I found both of above code samples on MacOSXHints and they’ve been a big help when trying to position my hardware for maximum reception quality.

How to find a websites IP address

Finding the numerical IP address of a website is pretty easy, just launch your Terminal and type the following command:
nslookup google.com

You’ll then see something like this printed back at you:
$ nslookup google.com
Server: 192.168.0.105
Address: 192.168.0.105#74
Non-authoritative answer:
Name: google.com
Address: 74.125.127.147

The number underneath google.com is the IP address for Google. Note that some larger websites will have multiple IP responses.

There’s any number of reasons why you’d want a websites numerical address rather than their resolved domain, from troubleshooting DNS problems, to determining domain neighbors, to configuring network settings.

Unix How To: Planting a Tree, Unix-Style

Most people learn the mkdir command on the first day they start using Unix. Along with ls, cd and pwd, it’s in the set of the most basic commands that everyone who ventures onto the command line on a Unix system ought to know. It generally takes a while before they learn the more exotic uses of this simple command -- such a creating a branching tree structure with just one mkdir.

The simplest form of the mkdir command is, of course, creating a single directory.

mkdir mydir

As novice Unix users begin to pick up relative addressing and environment variables, they will probably figure out that they can take their directory creating skills a little further and may try commands such as these -- creating a directory inside an existing directory (without moving into the directory first), creating a directory in their home no matter where they’re starting from, creating a directory in the parent directory, creating temporary directories (with or without randomized names) and creating a directory using the output of Unix commands to name them.

mkdir mydir/newdir
mkdir ~/mydir
mkdir ../mydir
mkdir /tmp/$USER
mkdir /tmp/$USER$$
mkdir `date +%m%d%y`

Sometime later, new Unix users will likely run into the -p option that allows them to create deeply embedded directories without first having to create all the intermediate folders. Ah, the joy of Unix!

mkdir -p mydir/a/b/c/d/e

It isn’t until the mkdir command is combined with brace expansion that things get really exciting (and a little hard to parse!).

Once you add {a,b,c} type syntax to a mkdir -p command, you can create a branching tree rather than just a straight sequence of directories inside directories.

Create multiple directories with one command:

mkdir -p {onedir,twodir,threedir}

Create multiple directories inside a new directory with one command:

mkdir -p mydir/{onedir,twodir,threedir}

Create multiple directories inside a new directory with one command:

mkdir -p `date +%m%d%y`/{bin,data,doc,refs}

Create a fairly complex directory structure with one command:

mkdir -p `date +%m%d%y`/{bin,data/{raw,proc},doc/{config,man},refs}

To grasp what this command is doing, it helps to start by breaking out the items in the list inside the outer brackets, ignoring the contents of the inner brackets for now.

mkdir -p `date +%m%d%y`/{bin,data/{raw,proc},doc/{config,man},refs}
                         --- =============== ---------------- ====

So, this command will create directories named bin, data, doc and refs within the dated directory.

Then, you can break out the contents of the inner braces.

mkdir -p `date +%m%d%y`/{bin,data/{raw,proc},doc/{config,man},refs}
                         --- =============== ---------------- ====
                                   --- ====       ------ ===

Now we can start to see that we’re creating a directory structure that looks like this:

         +- bin
         |        +- proc
051210 --+- data -+
         |        +- raw
         |
         |        +- config
         +- doc --+
         |        +- man
         +- refs

Since the structure is created in a single command, you could set it up as an alias if you care to. In any case, it makes fairly simple work out of setting up a set of standard folders for users or projects.

Discover the last used command beginning with anything without executing it

If you want to discover the last time a specific command was used without actually executing it, follow this format at the command line:

!sudo:p

The above example will print back the last usage of the ’sudo’ command without actually executing it, which is very useful in some situations (like the situation below, where the last time the sudo command was used was deleting everything recursively!). You will see the last used command printed directly below:

$ !sudo:p
sudo rm -rf /var/logs/*

This works with anything, even incomplete commands. Can’t remember that obscure command you used last week, but you know it started with a t? No problem!

!t:p
might print something like this:
time grep -c and rewin.sh

It’s important to note the :p modifier at the end of the command is what is responsible for printing out the command rather than executing it, which is the default behavior for the bash history command ! so if you had just typed !p it would execute the last time a command beginning with ‘p’ was executed, but !p:p will print out the command minus the execution.

Create an instant web server via Terminal command line

You can instantly create a web server from the command line by typing:

python -m SimpleHTTPServer

This will publish the current directory as a web server immediately, so if you have an index.html file that will immediately be displayed, otherwise it will just list the directory contents at your localhost IP. If you wish to specify a port you may do so by following the command with an open port number:

python -m SimpleHTTPServer 4104

This is a handy tip if you’re doing some quick web development and want to immediately check it in a browser or show it to someone else. This should work on any unix variant, FreeBSD, Linux, and of course Mac OS X included.

Speed up a slow Terminal by clearing log files

The Mac OS X Terminal can become slow to launch over time, but there’s an easy solution to speed it up again. By deleting the Apple System Logs, you can shave the lag in opening and launching new Terminal windows/tabs dramatically, in my case from about a three second delay to instantaneous!

Here’s how to delete the log files and gain your Terminal launch speed back:

At the command line type the following:
cd /private/var/log/asl/
then, inside that directory, type:
sudo rm -f *

Warning: be absolutely certain that you only type the sudo rm -rf command INSIDE the /var/log/asl/ directory! rm -rf * deletes all files in a directory, no questions asked, so if you perform that task in the wrong directory (like home folder) you are going to have a serious problem! I’m assuming you have moderate experience in the command line environment – if you do not, you probably won’t need this tip anyway.

iTunes loading slowly? Here’s a simple fix to speed launch

From time to time iTunes can take a very long time to open. This simple fix seems to resolve the slow application launch:

  • Launch iTunes
  • Immediately hit and hold the “Option” key
  • Select your iTunes Library, usually /Music/iTunes/
  • Click OK

iTunes should now but be considerably faster when loading and quitting. The interesting thing is that you’re loading the same music library as before, so the speedup must be related to a more recent cache being available.

Jailbreak for iPad released

The Spirit Jailbreak for iPad has been released, it’s an untethered Jailbreak for any of the current iPhone OS devices, so the iPad as well as iPhone and iPod touch are supported. It’s still in beta so it’s definitely a good idea to sync and backup all your data before trying this out. Many of the Cydia apps not designed for iPad may run a little strange, look poorly, or even ’screw up your system’ as the Spirit developers say. It’s also worth noting that Spirit is not a carrier unlock, so don’t expect to jump around mobile providers.

Here are the requirements:

* iPad, iPhone, iPod touch on firmware 3.1.2, 3.1.3, or 3.2.
* iTunes 9 (including 9.1.1).
* An activated device: one not stuck on the Connect to iTunes or Emergency Call screen.
* A Mac or Windows PC

If you’re interested in Jailbreaks, check out the Spirit Jailbreak developer for more.