Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an Android phone that connects with my computer via MTP. This works fine; I can see and transfer files with Nautilus. However, I often want to use the terminal to move large numbers of files, and I cannot seem to find the device anywhere in the filesystem tree. Nautilus reports the location as mtp://[usb:003,007]/, but it's not under /media or /mnt.

Does anyone know where it is?

share|improve this question

6 Answers 6

up vote 20 down vote accepted

Asker's edit: This seems to require a newer version of libmtp and/or gvfs than is available per default in 13.04. Run sudo add-apt-repository ppa:langdalepl/gvfs-mtp and update before doing anything else.

Edit: PPA not needed anymore in saucy/13.10, filenames are listed in terminal as they are in Nautilus.

As you have already found out, the mountpoints are in /run/user/$USER/gvfs/ and are named after the protocol, connection type and address they use. Which makes things more difficult, because the connection address may change every time you replug the device, even if it is the same port. If you have the same device twice it gets even worse.

You can use lsusb to display all connected USB devices from terminal:

$ lsusb | grep Google                       # Note: This is a Nexus 4
Bus 002 Device 025: ID 18d1:4ee2 Google Inc.

As you have noticed Nautilus also gives this information via tool tip. You will find the encoded form of e.g. mtp://[usb:002,025] in /run/user/$USER/gvfs as mtp:host=%5Busb%3A002%2C025%5D

A shell script would look like this:


# Find the path to MTP/PTP connected device by USB ID
find_path_by_usbid () {
        lsusboutput="$(lsusb -d $1 | head -n1)"
        usbbus="${lsusboutput% Device*}"
        usbbus="${usbbus#Bus }"
        usbdevice="${usbdevice#*Device }"

        # Media Transfer Protocol
        if [ -d "$XDG_RUNTIME_DIR" ]; then
        # Picture Transfer Protocol

        if [ -d "$MtpPath" ]; then
                echo "$MtpPath"
        elif [ -d "$PtpPath" ]; then
                echo "$PtpPath"
                echo "Error: File or directory was not found." 

# USB ID for Nexus 4
Path="$(find_path_by_usbid $Id)"

# Backup pictures if device is connected
if [ "$Path" == "Error: File or directory was not found." ]; then
        echo "$Path"
        rsync -av --progress $Path/DCIM/Camera/ ~/Pictures/Backup_Nexus4/
share|improve this answer
Thank you for your answer. Unfortunately, it doesn't work because the actual folder names (e.g. /DCIM/Camera/) are only visible in Nautilus, not the terminal. Thus, $Path/DCIM/Camera is not accessible with rsync. –  bessman Sep 8 '13 at 14:16
The path is just an example and is different for Android phones. The phone must also be unlocked via lock screen to allow access to the data. –  LiveWireBT Sep 8 '13 at 15:37
The path /DCIM/Camera/ exists on my phone, but in the terminal it is called /2404/2407/. That's the problem. If I cd into /2404/2407/ and run nautilus ., then /DCIM/Camera/ is opened. The phone is unlocked, otherwise I wouldn't be able to access it via Nautilus, right? –  bessman Sep 8 '13 at 17:37
That's odd, there should be no difference between Terminal and Nautilus. I don't know details of how MTP works on a deeper level and where your issue is rooted. You could try switching to PTP protocol and see if you get proper file names in this mode. My desktop runs on 12.10 with GVFS-MTP PPA and my phone runs CM 10.2 nightlies. –  LiveWireBT Sep 9 '13 at 14:22
I am (or was) on vanilla 13.04. Phone runs CM 10.2 nightly. I added ppa:langdalepl/gvfs-mtp to my sources and now it works as expected! Thank you, if you edit your answer to say to run sudo add-apt-repository ppa:langdalepl/gvfs-mtp first I'll accept it. –  bessman Sep 10 '13 at 14:54

Type mount. That will list every active filesystem.

share|improve this answer
No, the device does not show up in the output. –  LiveWireBT Sep 6 '13 at 22:54
Hmm. That sort of worked. I found it under /run/user/myusername/gvfs/. However, all the foldernames are just numbers instead of the actual names that I see in Nautilus. As such, it doesn't really solve my problem because I still can't easily use the terminal to move files to the device. –  bessman Sep 7 '13 at 7:21
When Nautilus has the MTP device open, use the commands lsof -c nautilus | less to list all file files Nautilus has open. –  waltinator Feb 3 '14 at 19:13

My Nexus device's memory can be accessed at:


where 1000 is my user ID.

share|improve this answer

This is not a direct answer to the problem, but a solution none the less..

After experiencing inconsistency's with USB connectivity, I bypassed the .gvfs and USB system all together.

I installed a simple ftp server on the android and whoala! Connect to server (either ftp with login or without, depending on how you choose) from Nautilus/nemo/thunar and away ya go.

Syncronisation of folders is handled through OwnCloud and/or BitTorrentSync

And the FTP over wireless is way quicker than the USB connection was.

share|improve this answer

MTP is a protocol, much like FTP or SSH. It fetches files when the user asks for it. Thus there is no mounted file system on the computer.

Use mtpfs in order to make it appear like a mounted file system.

mtpfs <a_folder_to_mount>

No need to specify the device. If you have only one device connected, then there is no ambiguity. I have not tested it with multiple devices connected to my computer.

share|improve this answer

MTP mounted device usually can be found in : /run/user/1000/gvfs/

for eg if your Nautilus address bar shows mtp://[usb:001,006]/, then you can access by:


now on terminal you can copy files or folders:

  • cd into folder -> cd /run/user/1000/gvfs/mtp\:host=%5Busb%3A001%2C006%5D/
  • then copy required folders to current directory -> cp -r ~/videos/ .
share|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. –  Luís de Sousa Mar 10 at 13:34
-1 The issue isn't the copy program but the mount point. –  David Foerster Mar 10 at 14:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.