How do I cd into mounted Samsung phone through bash

zadrozny

According to Gnome / Nautilus, these files reside at: mtp://[usb:001,007]

But:

$ cd mtp://[usb:001,007]
bash: cd: mtp://[usb:001,007]: No such file or directory

And df -h doesn't list it.

While lsusb suggests it's there:

Bus 001 Device 008: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy (MTP)

Anthony Geoghegan

Short answer: You can’t cd to this directory.

Media Transfer Protocol (MTP)

Media Transfer Protocol (MTP) uses a special API that to provide limited access to files on a device. As I understand it, it was originally designed by Microsoft for use with proprietary software compatible with its digital restriction system.

The protocol became an official USB device class in 2008 and it provides a standard means of transferring media and metadata between a computer and an external device. It is not tied to DRM and the ever-innovative FOSS community developed the libmtp library to support MTP devices.

The mtp://[usb:001,007] URL is a GNOME Virtual file system which uses libmtp as its backend. Since MTP abstracts away the filesystem, it’s not mounted in the same way as a regular storage device so it will not be listed by the mount or df commands.

The MTP Wikipedia article has a good description of the protocol and lists the advantages to using MTP for accessing files on an external device.

The comprehensive MTP article on the Arch Linux Wiki has tonnes of useful information on using MTP with GNU/Linux (most of the information is not distribution-specific).

Mass Storage Class (MSC)

If you want to treat the files on the Samsung device as a regular filesystem that can be mounted like any other storage device (and use cd), you would need to configure the device to present itself as a Mass Storage Class (MSC) (aka UMS) device. Some devices can be configured to use either method. I have a Sony Android phone that allows either method but I’ve always connected to its SD card using USB Mass Storage (even though it means the Android OS has to unmount the SD card, to allow the GNU/Linux OS to mount it).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I cd the remote server directory mounted through File/Nautilus?

How do I retrieve a contact through the native phone book?

How do I CD to parent of deleted directory? (bash: cd: ..: No such file or directory)

How do I check where devices are mounted?

How do I rename a mounted Truecrypt volume?

How can I view all the folders currently mounted through sshfs?

Bash - How do I loop through sub directories and execute this command

How do I verify SSL connection with a server through bash?

How do I loop through only directories in bash?

How do I pass parameters with whitespaces to bash through subprocess?

How do I create a new mysql database/schema through bash?

How do I pass a set of bash commands through SSH?

How can I cd using a variable in bash

How to create alias for git bash to make fast cd through directories

How do I cd to the closest parent folder that has a .git folder with bash?

How do I make a cd command take effect outside of the bash script subshell?

How do I send SMSes from my computer through an Android phone?

How do I pass custom header through web browser for Windows Phone 8?

Samsung Companion App: Do we need Samsung Gear App on Phone?

How do I find which external drive a folder is mounted from?

Accidentally mounted partition to /var, how do I fix that?

How do I specify mounted windows shares as a command line path?

How do I set the state of a service to disabled in an offline mounted system

How do I set permissions for a specific (mounted) location?

How do I update props on a manually mounted vue component?

How do I delete shared memory that was used by mounted tmpfs directory?

How do I access mounted hard drive with a Snap application?

How do I retrieve basic information about an afs mounted filesystem

How do I ensure an NFS share stays mounted?