REWRITE (17-10-2013): I recommend using Entangle camera control software @ The rest of the post is quite old but kept here for reference.

UPDATE (7-7-2012): I have been wanting to update this, but kept postponing it for random reasons. Anyway, this Post is little outdated and has serious mistakes in the script. I will try and post a more correct version soon.

Experimenting with tethering D90 on linux came across this very useful command line utility called gphoto. Connect the D90 (or your camera) to the USB port of the computer, then switch it on and launch gphoto2. To check if the camera is detected run,

# gphoto2 –auto-detect
Sample output
Model                          Port
Nikon DSC D90 (PTP mode)       usb:001,006

Here is a simple script that can capture and download picture (upon pressing and releasing the shutter) taken while the camera is connected to the computer automatically and deleting it when the script is stopped.

Save the below text as “” and mark it as an executable.

echo “Press CTRL-C to quit.\n”;
gphoto2 –wait-event-and-download
gphoto2 –delete-all-files –recurse

some other functions that gphoto supports can be found by using

# gphoto2 –help

There are some other very cool features available that include automatically capturing a picture and download by using,

# gphoto2 –capture-image-and-download