Tethered shooting on Ubuntu Linux using gPhoto2

Photo by Jacob Garcia

My D70, like most digital cameras, has a USB port that allows me to connect it to my computer and download photos. Many cameras also allow you to control them using your computer when they are connected. This is called tethered shooting. You click the shutter and a few seconds later the photo is displayed in all its glory on your big screen monitor. This can come in extremely handy in studio situations. It’s a great trick for quickly checking that you’re capturing the shots you want without squinting at a 2 or 3 inch LCD.

On a lark it occurred to me to do something goofy with my camera (more on that in a minute). On the way to crazy town I came up with a way to do basic tethered shooting on Linux.

I’m using Ubuntu Linux but, in theory, this should work on any Linux system that can run gphoto2. gphoto2 is a magical command line utility that lets you control your camera connected via USB cable. With it, you can download photos and even cause the camera to capture images. To install it on Ubuntu, start Synaptic and search for gphoto2.

Next, download the following scripts: Download

(These scripts are all open source and I’m releasing them under a BSD license which basically means you can do whatever you want with them.)

Uncompress them into a new folder or put them somewhere on your path. Then right click each file, open its properties, and select the Permissions tab. Make sure the “Execute” checkbox is checked.

Then, connect your camera to your computer using a USB cable, turn it on, and run the tether script by double-clicking it and choosing Run in terminal (you can do all of this at the command line as well but I figure you command line guys already know that).

Now take a photo. If all goes well, you should see it download the photo into the folder and then display it for you. Your results may vary. I’ve tested this setup with exactly one camera. If all does not go well (and let’s face it, the probability of that is definitely not zero), take a look at the troubleshooting suggestions in the README file included in the download.

So what was the goofy idea that prompted all of this? I wanted to see if I could connect my camera to my microphone. The soundtrigger script in the download works the same way as tether except it takes the photo for you when you snap your fingers. Literally. I told you it was goofy. I can’t think of many good uses for that. Maybe if you have a laptop you could set up the whole contraption outside next to a bird feeder…

By John Watson

John Watson is the original founder of Photodoto. If you're interested in what John has been up to, you can browse his personal blog.


  1. Thanks for the great script!

    The only problem I had with it is that the since the script deleted the files everytime time after it copied it, the file scheme went back to whatever_1.JPG, so it gave asked me if I wanted to overwrite instead of opening up the new file. I tweaked the tether script a bit so that it saves the files as 1.jpg, 2.jpg, 3.jpg, and so forth, so each picture is saved and pops up on your screen, without asking you if you want to overwrite. I also tweaked the view script to open up Eye of Gnome in full screen.

    I didn’t do anything with the soundtrigger script, but I’m sure it could easily be adapted. Here’s my revisions in case anyone else would like to use them:

  2. Make sure to put the camera to PTP mode from the Mass Storage Mode, in my case for Nikon D70. I spent hours trying to find out why the gphoto2 –auto-dectect does not work. After I put the Camera to PTP mode from M mode(Mass storage), it works great. It should have been mentioned in the article.
    Anyhow, thank you very much. This is what I have been looking for to shoot the home studio indoor portraits.

    Thank you.

  3. BTW, my Linux is fedora8, and I am using the preinstalled gphoto2, the one you can install using add/remove program.s

  4. Hi, thats really cool, i looked for something like this really long time. I have two nikons Coolpix 5700 – tether works at all with no changes in the script, but i can’t force it to take pictures with soundtrigger; Coolpix L12 – tether doesn’t work, soundtrigger takes the picture but doesn’t copy it to the computer. I hope, I fix it;-)

  5. Hi. I have Acer AspireOne with Linplus Linux. Gphoto2 does not get connected to EOS 5D. It says something about reserved USB-port (Error message is like this “ould not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (e.g. dc2xx or stv680) is using the device and you have read/write access to the device. ”

    Has someone solution for “out-of-the box” aspire one and this great tether-script.

    Thank you.

    1. I don’t know. It could be the camera isn’t recognized by Gphoto2 (solution: wait for an upgrade to Gphoto2). Or it could be that the camera was mounted as a filesystem which is interfering with direct USB camera access (solution: unmount it).

  6. Fantastic! I’m doing a dance event in April and one idea I have is to setup a “photo nook” where people can go, grab a remote, and snap some nice, high-quality pics of themselves together at this event. I’ll setup all the lighting, camera, cool background all of that and basically “pre-compose” the shot for them…all they have to do is get some friends, make goofy faces at the camera, press the remote, and voila!

    Now I’ll be able to additionally show the pictures live on the computer screen as soon as they take them. Yes, fantastic. Thanks a ton.

  7. Nice one, I think the sound of a snapping finger or clapping hand makes more sense than what I did which is using voice recognition to push the button on the form (I’m doing this in Windows).

    I’ll have to work out how I can receive sounds generically rather than via the speech recognition module. As I’m doing this all in scripting language I’m limited to what interfaces there are.

    But the idea of doing a photobooth like John Ford said — I think this is great and I need to see how I can make my script more suitable for that.

  8. Thanks for this description and scripts! I have Canon EOS 30D and had some trouble with downlading. My 30D was always BUSY and I was unable to take pictures.
    1. Unmount the camera folder every time, if it is mounted automatically when you switch on or connect camera.
    2. Include “gphoto2 –set-config capture=off” before the “while” command to switch camera back to normal mode (to enable taking pictures).
    3. Because “eog” does not show my canon raw files, I changed it in the view script to “f-spot -v “$ARGUMENT” &”. And the “pkill” to “pkill f-spot”.

    Thanks again, for this tutorial!

  9. Nice little scripts. I tried it (tether only, not soundtrigger) with Nikon D200. It works fine, except that it keeps trying to all previous shots on the memory card rather than only the last one. So in tether, I replaced the two gphoto2 commands by this one:
    gphoto2 –capture-tethered –hook-script=view
    Now it works perfectly !

    1. Just a request for clarity. You said you changed the script
      to “gphoto2 –capture-tethered –hook-script=view”.
      I was looking at the documentation for gphoto2 and it looks
      like your line listed here is incorrect where you have
      “-hook-script=view”. Or am I reading it wrong? I would really like to know because I will use this script for a photo shoot in a couple of weeks and would really like to try it out.

      Thanks for your time

    2. using the –new flag can have the same effect on some cameras

      so it would read

      gphoto2 –folder=”$CAMERA_FOLDER” –get-all-files –new –hook-script=view
      (I think, going to test it now)

Leave a comment

Your email address will not be published. Required fields are marked *