how to access my Android phone from my terminal?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







8















I plugged my Kit-kat android phone up to my Ubuntu 14.04 computer and I enter the terminal and I want to be able to access files on my phone like the media and music folders through the terminal... is this possible?










share|improve this question























  • Depends on the vendor. Some (Samsung) make it harder, others easier.

    – mikewhatever
    Mar 13 '15 at 19:21











  • I have the note 4 @mikewhatever

    – cmehmen
    Mar 13 '15 at 19:25






  • 2





    ...and what happens when you connect it? Does Ubuntu see it? What's the output of dmesg? Is there an option is the phone settings to allow connecting to USB?

    – mikewhatever
    Mar 13 '15 at 20:15


















8















I plugged my Kit-kat android phone up to my Ubuntu 14.04 computer and I enter the terminal and I want to be able to access files on my phone like the media and music folders through the terminal... is this possible?










share|improve this question























  • Depends on the vendor. Some (Samsung) make it harder, others easier.

    – mikewhatever
    Mar 13 '15 at 19:21











  • I have the note 4 @mikewhatever

    – cmehmen
    Mar 13 '15 at 19:25






  • 2





    ...and what happens when you connect it? Does Ubuntu see it? What's the output of dmesg? Is there an option is the phone settings to allow connecting to USB?

    – mikewhatever
    Mar 13 '15 at 20:15














8












8








8


4






I plugged my Kit-kat android phone up to my Ubuntu 14.04 computer and I enter the terminal and I want to be able to access files on my phone like the media and music folders through the terminal... is this possible?










share|improve this question














I plugged my Kit-kat android phone up to my Ubuntu 14.04 computer and I enter the terminal and I want to be able to access files on my phone like the media and music folders through the terminal... is this possible?







command-line android






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 13 '15 at 18:54









cmehmencmehmen

1693411




1693411













  • Depends on the vendor. Some (Samsung) make it harder, others easier.

    – mikewhatever
    Mar 13 '15 at 19:21











  • I have the note 4 @mikewhatever

    – cmehmen
    Mar 13 '15 at 19:25






  • 2





    ...and what happens when you connect it? Does Ubuntu see it? What's the output of dmesg? Is there an option is the phone settings to allow connecting to USB?

    – mikewhatever
    Mar 13 '15 at 20:15



















  • Depends on the vendor. Some (Samsung) make it harder, others easier.

    – mikewhatever
    Mar 13 '15 at 19:21











  • I have the note 4 @mikewhatever

    – cmehmen
    Mar 13 '15 at 19:25






  • 2





    ...and what happens when you connect it? Does Ubuntu see it? What's the output of dmesg? Is there an option is the phone settings to allow connecting to USB?

    – mikewhatever
    Mar 13 '15 at 20:15

















Depends on the vendor. Some (Samsung) make it harder, others easier.

– mikewhatever
Mar 13 '15 at 19:21





Depends on the vendor. Some (Samsung) make it harder, others easier.

– mikewhatever
Mar 13 '15 at 19:21













I have the note 4 @mikewhatever

– cmehmen
Mar 13 '15 at 19:25





I have the note 4 @mikewhatever

– cmehmen
Mar 13 '15 at 19:25




2




2





...and what happens when you connect it? Does Ubuntu see it? What's the output of dmesg? Is there an option is the phone settings to allow connecting to USB?

– mikewhatever
Mar 13 '15 at 20:15





...and what happens when you connect it? Does Ubuntu see it? What's the output of dmesg? Is there an option is the phone settings to allow connecting to USB?

– mikewhatever
Mar 13 '15 at 20:15










2 Answers
2






active

oldest

votes


















8














You can find the mount point under the $XDG_RUNTIME_DIR/gvfs directory. The main directory may be something like mtp:host=… with some escaped characters and USB vendor/product IDs, but you should be able to access your files from in there in a terminal.






share|improve this answer
























  • I'm uncertain how to follow your instructions. What directory is $XDG_RUNTIME_DIR/gvfs in? I can't find it anywhere. Is it hidden?

    – Sarah Szabo
    Jan 30 '18 at 0:51






  • 1





    The $XDG_RUNTIME_DIR defaults to /run/user/$UID/ I think. There is a gvfs sub-directory within it.

    – dobey
    Jan 30 '18 at 3:02











  • I've found the gvfs directory, but I don't see anything in it using the ls` command.

    – Sarah Szabo
    Jan 30 '18 at 21:40











  • OK. This was working when I answered the question in 2015 on 14.04. Maybe something changed/broke in newer Ubuntu in relation to this?

    – dobey
    Jan 30 '18 at 23:05











  • Possibly, should I re-ask the question, bu with it related to modern systems?

    – Sarah Szabo
    Jan 31 '18 at 2:20



















7














Android devices usually uses the Media Transfer Protocol (MTP) when connecting via the USB. This protocol works differently than the traditional USB.



Simply put, this is a way to ensure that the phone does not share too much data with the computer. The computer makes a query, and the phone answers it. The phone may decide to share the file or ignore the query. Similarly, when the computer deletes a file, the phone has the ability to decide whether to actually delete the file or not.



Okay, enough introduction. To access a device connected via MTP, you need the information about it's #Bus and #Dev. To do so, you can run the following command.



usb-devices



This will provide you with a list of connected usb-devices. You need to find your device from this list. It can be a bit tiring, so you can search for the device with the available Manufacturer option. Simply use the following command.



usb-devices  | grep "Manufacturer=OnePlus" -B 3


This will provide you with 4 lines of information, where the firs line is as follows.



T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 13 Spd=480 MxCh= 0


As you can see here, the associated Bus is 02, and Dev is 13.



Now change your directory to /run/user/1000/gvfs/ and see the list of folders there.



/run/user/1000/gvfs/
ls


You will find the associated MTP device with the #Bus and #Dev in the list. For example, mine was mtp:host=%5Busb%3A002%2C013%5D. Now simply change your directory using the following command.



cd mtp:host=%5Busb%3A002%2C013%5D/


Voila!
You are inside the file storage!






share|improve this answer



















  • 1





    Awesome! Worked like a charm, thx

    – Justin
    Oct 3 '18 at 5:30






  • 1





    Worked like a charm, but it wasn't mpt:host, it was gphoto2:host

    – user1271772
    Oct 13 '18 at 0:24











  • What if there is nothing in /run/user/1000/gvfs/. My ls doesn't show anything.

    – Nikhil Wagh
    Oct 22 '18 at 10:17












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f596441%2fhow-to-access-my-android-phone-from-my-terminal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









8














You can find the mount point under the $XDG_RUNTIME_DIR/gvfs directory. The main directory may be something like mtp:host=… with some escaped characters and USB vendor/product IDs, but you should be able to access your files from in there in a terminal.






share|improve this answer
























  • I'm uncertain how to follow your instructions. What directory is $XDG_RUNTIME_DIR/gvfs in? I can't find it anywhere. Is it hidden?

    – Sarah Szabo
    Jan 30 '18 at 0:51






  • 1





    The $XDG_RUNTIME_DIR defaults to /run/user/$UID/ I think. There is a gvfs sub-directory within it.

    – dobey
    Jan 30 '18 at 3:02











  • I've found the gvfs directory, but I don't see anything in it using the ls` command.

    – Sarah Szabo
    Jan 30 '18 at 21:40











  • OK. This was working when I answered the question in 2015 on 14.04. Maybe something changed/broke in newer Ubuntu in relation to this?

    – dobey
    Jan 30 '18 at 23:05











  • Possibly, should I re-ask the question, bu with it related to modern systems?

    – Sarah Szabo
    Jan 31 '18 at 2:20
















8














You can find the mount point under the $XDG_RUNTIME_DIR/gvfs directory. The main directory may be something like mtp:host=… with some escaped characters and USB vendor/product IDs, but you should be able to access your files from in there in a terminal.






share|improve this answer
























  • I'm uncertain how to follow your instructions. What directory is $XDG_RUNTIME_DIR/gvfs in? I can't find it anywhere. Is it hidden?

    – Sarah Szabo
    Jan 30 '18 at 0:51






  • 1





    The $XDG_RUNTIME_DIR defaults to /run/user/$UID/ I think. There is a gvfs sub-directory within it.

    – dobey
    Jan 30 '18 at 3:02











  • I've found the gvfs directory, but I don't see anything in it using the ls` command.

    – Sarah Szabo
    Jan 30 '18 at 21:40











  • OK. This was working when I answered the question in 2015 on 14.04. Maybe something changed/broke in newer Ubuntu in relation to this?

    – dobey
    Jan 30 '18 at 23:05











  • Possibly, should I re-ask the question, bu with it related to modern systems?

    – Sarah Szabo
    Jan 31 '18 at 2:20














8












8








8







You can find the mount point under the $XDG_RUNTIME_DIR/gvfs directory. The main directory may be something like mtp:host=… with some escaped characters and USB vendor/product IDs, but you should be able to access your files from in there in a terminal.






share|improve this answer













You can find the mount point under the $XDG_RUNTIME_DIR/gvfs directory. The main directory may be something like mtp:host=… with some escaped characters and USB vendor/product IDs, but you should be able to access your files from in there in a terminal.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 13 '15 at 19:59









dobeydobey

33k33886




33k33886













  • I'm uncertain how to follow your instructions. What directory is $XDG_RUNTIME_DIR/gvfs in? I can't find it anywhere. Is it hidden?

    – Sarah Szabo
    Jan 30 '18 at 0:51






  • 1





    The $XDG_RUNTIME_DIR defaults to /run/user/$UID/ I think. There is a gvfs sub-directory within it.

    – dobey
    Jan 30 '18 at 3:02











  • I've found the gvfs directory, but I don't see anything in it using the ls` command.

    – Sarah Szabo
    Jan 30 '18 at 21:40











  • OK. This was working when I answered the question in 2015 on 14.04. Maybe something changed/broke in newer Ubuntu in relation to this?

    – dobey
    Jan 30 '18 at 23:05











  • Possibly, should I re-ask the question, bu with it related to modern systems?

    – Sarah Szabo
    Jan 31 '18 at 2:20



















  • I'm uncertain how to follow your instructions. What directory is $XDG_RUNTIME_DIR/gvfs in? I can't find it anywhere. Is it hidden?

    – Sarah Szabo
    Jan 30 '18 at 0:51






  • 1





    The $XDG_RUNTIME_DIR defaults to /run/user/$UID/ I think. There is a gvfs sub-directory within it.

    – dobey
    Jan 30 '18 at 3:02











  • I've found the gvfs directory, but I don't see anything in it using the ls` command.

    – Sarah Szabo
    Jan 30 '18 at 21:40











  • OK. This was working when I answered the question in 2015 on 14.04. Maybe something changed/broke in newer Ubuntu in relation to this?

    – dobey
    Jan 30 '18 at 23:05











  • Possibly, should I re-ask the question, bu with it related to modern systems?

    – Sarah Szabo
    Jan 31 '18 at 2:20

















I'm uncertain how to follow your instructions. What directory is $XDG_RUNTIME_DIR/gvfs in? I can't find it anywhere. Is it hidden?

– Sarah Szabo
Jan 30 '18 at 0:51





I'm uncertain how to follow your instructions. What directory is $XDG_RUNTIME_DIR/gvfs in? I can't find it anywhere. Is it hidden?

– Sarah Szabo
Jan 30 '18 at 0:51




1




1





The $XDG_RUNTIME_DIR defaults to /run/user/$UID/ I think. There is a gvfs sub-directory within it.

– dobey
Jan 30 '18 at 3:02





The $XDG_RUNTIME_DIR defaults to /run/user/$UID/ I think. There is a gvfs sub-directory within it.

– dobey
Jan 30 '18 at 3:02













I've found the gvfs directory, but I don't see anything in it using the ls` command.

– Sarah Szabo
Jan 30 '18 at 21:40





I've found the gvfs directory, but I don't see anything in it using the ls` command.

– Sarah Szabo
Jan 30 '18 at 21:40













OK. This was working when I answered the question in 2015 on 14.04. Maybe something changed/broke in newer Ubuntu in relation to this?

– dobey
Jan 30 '18 at 23:05





OK. This was working when I answered the question in 2015 on 14.04. Maybe something changed/broke in newer Ubuntu in relation to this?

– dobey
Jan 30 '18 at 23:05













Possibly, should I re-ask the question, bu with it related to modern systems?

– Sarah Szabo
Jan 31 '18 at 2:20





Possibly, should I re-ask the question, bu with it related to modern systems?

– Sarah Szabo
Jan 31 '18 at 2:20













7














Android devices usually uses the Media Transfer Protocol (MTP) when connecting via the USB. This protocol works differently than the traditional USB.



Simply put, this is a way to ensure that the phone does not share too much data with the computer. The computer makes a query, and the phone answers it. The phone may decide to share the file or ignore the query. Similarly, when the computer deletes a file, the phone has the ability to decide whether to actually delete the file or not.



Okay, enough introduction. To access a device connected via MTP, you need the information about it's #Bus and #Dev. To do so, you can run the following command.



usb-devices



This will provide you with a list of connected usb-devices. You need to find your device from this list. It can be a bit tiring, so you can search for the device with the available Manufacturer option. Simply use the following command.



usb-devices  | grep "Manufacturer=OnePlus" -B 3


This will provide you with 4 lines of information, where the firs line is as follows.



T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 13 Spd=480 MxCh= 0


As you can see here, the associated Bus is 02, and Dev is 13.



Now change your directory to /run/user/1000/gvfs/ and see the list of folders there.



/run/user/1000/gvfs/
ls


You will find the associated MTP device with the #Bus and #Dev in the list. For example, mine was mtp:host=%5Busb%3A002%2C013%5D. Now simply change your directory using the following command.



cd mtp:host=%5Busb%3A002%2C013%5D/


Voila!
You are inside the file storage!






share|improve this answer



















  • 1





    Awesome! Worked like a charm, thx

    – Justin
    Oct 3 '18 at 5:30






  • 1





    Worked like a charm, but it wasn't mpt:host, it was gphoto2:host

    – user1271772
    Oct 13 '18 at 0:24











  • What if there is nothing in /run/user/1000/gvfs/. My ls doesn't show anything.

    – Nikhil Wagh
    Oct 22 '18 at 10:17
















7














Android devices usually uses the Media Transfer Protocol (MTP) when connecting via the USB. This protocol works differently than the traditional USB.



Simply put, this is a way to ensure that the phone does not share too much data with the computer. The computer makes a query, and the phone answers it. The phone may decide to share the file or ignore the query. Similarly, when the computer deletes a file, the phone has the ability to decide whether to actually delete the file or not.



Okay, enough introduction. To access a device connected via MTP, you need the information about it's #Bus and #Dev. To do so, you can run the following command.



usb-devices



This will provide you with a list of connected usb-devices. You need to find your device from this list. It can be a bit tiring, so you can search for the device with the available Manufacturer option. Simply use the following command.



usb-devices  | grep "Manufacturer=OnePlus" -B 3


This will provide you with 4 lines of information, where the firs line is as follows.



T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 13 Spd=480 MxCh= 0


As you can see here, the associated Bus is 02, and Dev is 13.



Now change your directory to /run/user/1000/gvfs/ and see the list of folders there.



/run/user/1000/gvfs/
ls


You will find the associated MTP device with the #Bus and #Dev in the list. For example, mine was mtp:host=%5Busb%3A002%2C013%5D. Now simply change your directory using the following command.



cd mtp:host=%5Busb%3A002%2C013%5D/


Voila!
You are inside the file storage!






share|improve this answer



















  • 1





    Awesome! Worked like a charm, thx

    – Justin
    Oct 3 '18 at 5:30






  • 1





    Worked like a charm, but it wasn't mpt:host, it was gphoto2:host

    – user1271772
    Oct 13 '18 at 0:24











  • What if there is nothing in /run/user/1000/gvfs/. My ls doesn't show anything.

    – Nikhil Wagh
    Oct 22 '18 at 10:17














7












7








7







Android devices usually uses the Media Transfer Protocol (MTP) when connecting via the USB. This protocol works differently than the traditional USB.



Simply put, this is a way to ensure that the phone does not share too much data with the computer. The computer makes a query, and the phone answers it. The phone may decide to share the file or ignore the query. Similarly, when the computer deletes a file, the phone has the ability to decide whether to actually delete the file or not.



Okay, enough introduction. To access a device connected via MTP, you need the information about it's #Bus and #Dev. To do so, you can run the following command.



usb-devices



This will provide you with a list of connected usb-devices. You need to find your device from this list. It can be a bit tiring, so you can search for the device with the available Manufacturer option. Simply use the following command.



usb-devices  | grep "Manufacturer=OnePlus" -B 3


This will provide you with 4 lines of information, where the firs line is as follows.



T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 13 Spd=480 MxCh= 0


As you can see here, the associated Bus is 02, and Dev is 13.



Now change your directory to /run/user/1000/gvfs/ and see the list of folders there.



/run/user/1000/gvfs/
ls


You will find the associated MTP device with the #Bus and #Dev in the list. For example, mine was mtp:host=%5Busb%3A002%2C013%5D. Now simply change your directory using the following command.



cd mtp:host=%5Busb%3A002%2C013%5D/


Voila!
You are inside the file storage!






share|improve this answer













Android devices usually uses the Media Transfer Protocol (MTP) when connecting via the USB. This protocol works differently than the traditional USB.



Simply put, this is a way to ensure that the phone does not share too much data with the computer. The computer makes a query, and the phone answers it. The phone may decide to share the file or ignore the query. Similarly, when the computer deletes a file, the phone has the ability to decide whether to actually delete the file or not.



Okay, enough introduction. To access a device connected via MTP, you need the information about it's #Bus and #Dev. To do so, you can run the following command.



usb-devices



This will provide you with a list of connected usb-devices. You need to find your device from this list. It can be a bit tiring, so you can search for the device with the available Manufacturer option. Simply use the following command.



usb-devices  | grep "Manufacturer=OnePlus" -B 3


This will provide you with 4 lines of information, where the firs line is as follows.



T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 13 Spd=480 MxCh= 0


As you can see here, the associated Bus is 02, and Dev is 13.



Now change your directory to /run/user/1000/gvfs/ and see the list of folders there.



/run/user/1000/gvfs/
ls


You will find the associated MTP device with the #Bus and #Dev in the list. For example, mine was mtp:host=%5Busb%3A002%2C013%5D. Now simply change your directory using the following command.



cd mtp:host=%5Busb%3A002%2C013%5D/


Voila!
You are inside the file storage!







share|improve this answer












share|improve this answer



share|improve this answer










answered May 17 '18 at 9:10









Muntasir WahedMuntasir Wahed

7111




7111








  • 1





    Awesome! Worked like a charm, thx

    – Justin
    Oct 3 '18 at 5:30






  • 1





    Worked like a charm, but it wasn't mpt:host, it was gphoto2:host

    – user1271772
    Oct 13 '18 at 0:24











  • What if there is nothing in /run/user/1000/gvfs/. My ls doesn't show anything.

    – Nikhil Wagh
    Oct 22 '18 at 10:17














  • 1





    Awesome! Worked like a charm, thx

    – Justin
    Oct 3 '18 at 5:30






  • 1





    Worked like a charm, but it wasn't mpt:host, it was gphoto2:host

    – user1271772
    Oct 13 '18 at 0:24











  • What if there is nothing in /run/user/1000/gvfs/. My ls doesn't show anything.

    – Nikhil Wagh
    Oct 22 '18 at 10:17








1




1





Awesome! Worked like a charm, thx

– Justin
Oct 3 '18 at 5:30





Awesome! Worked like a charm, thx

– Justin
Oct 3 '18 at 5:30




1




1





Worked like a charm, but it wasn't mpt:host, it was gphoto2:host

– user1271772
Oct 13 '18 at 0:24





Worked like a charm, but it wasn't mpt:host, it was gphoto2:host

– user1271772
Oct 13 '18 at 0:24













What if there is nothing in /run/user/1000/gvfs/. My ls doesn't show anything.

– Nikhil Wagh
Oct 22 '18 at 10:17





What if there is nothing in /run/user/1000/gvfs/. My ls doesn't show anything.

– Nikhil Wagh
Oct 22 '18 at 10:17


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f596441%2fhow-to-access-my-android-phone-from-my-terminal%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents