How to check the shutter count or actuations of a Canon 5D Mark III (and other DSLRs) using Ubuntu Server

  First, we install the required packages:  
sudo apt-get install gphoto2 libgphoto2-6
  Once that’s done installing, plug in your camera via it’s USB port and check that it is visible to the system:  
lsusb
  You should see an output along the lines of:
Bus 002 Device 002: ID 8087:8000 Intel Corp. Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 8087:8008 Intel Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 008: ID 051d:0002 American Power Conversion Uninterruptible Power Supply Bus 003 Device 007: ID 046b:ff31 American Megatrends, Inc. Bus 003 Device 006: ID 046b:ff40 American Megatrends, Inc. Bus 003 Device 005: ID 046b:ff20 American Megatrends, Inc. Bus 003 Device 004: ID 046b:ff10 American Megatrends, Inc. Virtual Keyboard and Mouse Bus 003 Device 002: ID 046b:ff01 American Megatrends, Inc. Bus 003 Device 009: ID 04a9:323a Canon, Inc. Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
You may have less or a lot more, depending on your system and how many USB devices you have connected. Assuming you have no other Canon devices connected, the part you’re looking for will have Canon in the line – here:  
Bus 003 Device 009: ID 04a9:323a Canon, Inc.
  You can also check using the dmesg command – once you have connected the camera there will be output at the end similar to:  
[1798492.201275] usb 3-10: new high-speed USB device number 9 using xhci_hcd [1798492.218967] usb 3-10: New USB device found, idVendor=04a9, idProduct=323a [1798492.218975] usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [1798492.218980] usb 3-10: Product: Canon Digital Camera [1798492.218984] usb 3-10: Manufacturer: Canon Inc.
Now we can run the following command:  
gphoto2 –get-config /main/status/shuttercounter
  You should then see the shutter count:  
Label: Shutter Counter Type: TEXT Current: 31791
  For this Canon 5D Mark III, the shutter count is 31,791. Lightly used!   To see a list of supported cameras for this method, see:  
http://gphoto.org/proj/libgphoto2/support.php