Tuesday, November 5, 2013

Connect Android and Linux using USB

I have a Samsung Galaxy Tab 2 tablet, running Android 4.1.1 (aka Jelly Bean). I'd like to transfer some files from the tablet to my Linux server running Debian 7.2 (aka Wheezy). The Android tablet connects via Wi-Fi to the same LAN as the Linux server.

There are many ways to transfer files between the 2 devices. For example, you could install an Android app named AirDroid which lets you manage your Android device from a desktop web browser, including file transfer. In this post, I'll go another route, an arguably more direct and basic one. I'll connect the 2 using a USB cable.

  1. Connect the 2 devices using a USB cable.
  2. With the Android device, navigate to the home page.
  3. Swipe down from the top of the page.

    You will see a message "Connected as a media device. Touch for other USB options"

  4. Tap on the message.

    The resulting screen specifies how you want the Android device to connect: as a Media device(MTP) or a Camera (PTP).

    While Linux has some support for MTP, I found it much easier to connect as PTP.

  5. Tap on the Camera (PTP) checkbox.
  6. Swipe down from home page again, and you will see that the tablet is mounted as a camera.
  7. Reset the USB device under Linux.

    The simplest way is to unplug the USB cable from both ends, and plug it back in.

  8. Make sure that the Android device is mounted on your Linux server.

    On my Linux GNOME 3 desktop, I clicked on the Computer icon, and the Android device was detected (GT-P3113). Click the device to mount it.

  9. Run your favourite file manager application on Linux, and proceed to transfer files.

You can use the above method to transfer files if you happen to have (the right) USB cable around to connect the 2 devices. If cables is not your preference, you may want to look into the Android app Airdroid.


Anonymous said...

Simple and fast. love it, thank you, Aah

Eric Klopper said...

Just saw your post now. Perfectly done. Between your solution and Airdroid I have everything I need for my Galaxy Note 3 / Debian integration.

Thanks from South Africa, Eric

Anonymous said...

Good job ! ...

Anonymous said...

Doesn't work for .mp3 files. Might be the cable...

Anonymous said...

Connecting as a camera will only transfer image files... all other types are not visible.

sarah said...

Thanks for this blog very usefull information

Ahamed Pasha said...

We can only transfer Image files. How to transfer videos and other files? Please help..

ben said...

Have you also been able to view video from the android camera via usb?

I've found some projects. but no luck