Having read this page, I decided to give AFT a try, so I installed it by sudo pacman -S android-file-transfer, connected the device (OnePlus 3T) to the computer through USB, set it to "Transfer files mode", and then opened AFT. So far so good, I see all folders inside my device, I can select files and dowload them. I haven't tried uploading, but I think everythig's ok.

Except that I'd prefer to browse the device in the terminal, so that I can make use of regexp to move stuff from/to the device.

I've found the following

$ ll /dev/disk/by-id
usb-OnePlus_Device_Driver_5abf662b-0:0 -> ../../sr0

but when I try

$ mkdir mount_here
$ sudo mount /dev/sr0 mount_here

all I see is this

$ ll mount_here
total 18466
dr-xr-xr-x 1 root   root       2048 Sep  7  2016  ./
drwx------ 1 enrico enrico      912 Jun 17 15:34  ../
-r-xr-xr-x 1 root   root    6538856 Mar  3  2015 'AndroidFileTransfer(OSX).dmg'*
-r-xr-xr-x 1 root   root   12320875 Sep  5  2016  OnePlus_USB_Drivers_Setup.exe*
-r-xr-xr-x 1 root   root      45056 Jun  3  2015  OnePlus_setup.exe*
-r-xr-xr-x 1 root   root        794 Jun 30  2015  adb_config_Linux_OSX.sh*
-r-xr-xr-x 1 root   root         97 Jun  3  2015  autorun.inf*
  • Run mount before and after attaching the device to see what changes. If nothing changes, you can always use aft-mtp-mount to mount it anywhere
    – Fox
    Jun 17, 2018 at 14:21
  • mount gives the same result before and after attaching the device; the same also after setting transfer files from Android. Then aft-mtp-mount mount_here gives Device::Find failed:Device is already used by another process if I set transfer files on the device, connect failed: no MTP device found if I had not.
    – Enlico
    Jun 17, 2018 at 16:46

2 Answers 2


Use adb to connect to your device in a CLI.


Enable Settings > Developer options > USB Debugging on your phone.

Install the drivers.

$ cd mount_here
$ ./adb_config_Linux_OSX.sh


Check if your device is found by adb:

$ adb devices
List of devices attached
bada5535    device

Now you can browse your device with:

$ adb shell
OnePlus7TPro:/ $ cd storage/self/primary
OnePlus7TPro:/storage/self/primary $ ls
Alarms Android DCIM Documents Download Movies Music Notifications Pictures Podcasts Ringtones

Move files with:

$ adb pull <path>

$ adb push <source-path> <target-path>

Trouble shooting

If you see this message:

$ adb devices
List of devices attached
bada5535    no permissions; see [http://developer.android.com/tools/device.html]

Try to start the adb server as root:

$ adb kill-server
$ sudo adb start-server
  • I'd really like to test your answer, but at the moment when I USB-connect the phone to the PC, I don't get the option, on the phone, for "file transfer" anymore. Therefore the command ll /dev/disk/by-id does not even show the phone, and there's nothing I can mount. Can you advice on this?
    – Enlico
    Jan 12, 2020 at 12:07
  • I'm referring to the option (in the dropdown) to choose what to do with the USB connection (file transfer, and other 2 or 3 possible choices). I remember that thing, but now it's no more there, regardless of the USB debugging option status.
    – Enlico
    Jan 13, 2020 at 19:16
  • @EnricoMariaDeAngelis There could be multiple causes and I'm not sure if I can advise on that, have you checked ` Settings > Storage > USB Computer Connection`?
    – A1rPun
    Jan 13, 2020 at 19:33
  • Together with USB debugging, I have found Settings > System > Developer options > Default USB configuration, which lists File Transfer, USB tethering, MIDI, PTP, No data transfer. I think these are the options that I should see in the dropdown when the phone is connected to the PC via USB. However I still don't see anything in the dropdown, and selecting File Transfer here where I've just found it, doesn't seem to change anything.
    – Enlico
    Jan 13, 2020 at 22:21
  • 1
    @EnricoMariaDeAngelis I suggest asking another question here on unix.SE because your issue is probably unrelated to your original question.
    – A1rPun
    Jan 14, 2020 at 9:25

If your requirement is

to browse the device in the terminal, so that I can make use of regexp to move stuff from/to the device.

on arch, I found that smple-mptfs in the AUR ( https://aur.archlinux.org/packages/simple-mtpfs/ ) actually works. This provides a single command simple-mtpfs and its man page. If even that is too much to read, here is a self-explanatory script posted by user teckk to the Newbie Corner of the arch wiki ( https://bbs.archlinux.org/viewtopic.php?pid=1729381#p1729381)

#! /usr/bin/env bash

#Script for simple-mtpfs    
PS3=$'\nSelect an option.: '

#mount directory

while :; do
    options="Quit List_Device Mount Umount"
    select opt in $options; do
        case $opt in
            Quit) clear; exit

            List_Device) simple-mtpfs --list-devices

            Mount) simple-mtpfs "$dir" -o enable-move; echo "Mounted to "$dir"" 

            Umount) fusermount -u "$dir"; echo "Unmounted" 

Note that libmtp is a prerequisite for simple-mtpfs, and that the mount point of the above script (default is $HOME/phone) must exist before you run the script.

Spelled out in even more detail: Here is the full set of commands I entered into a terminal (starting in the directory which I use to house AUR packages) to go from "nothing" to satisfying the requirement above:

sudo pacman -S libtmtp
git clone https://aur.archlinux.org/simple-mtpfs.git
cd simple-mtpfs
makepkg -si
#when prompted to confirm install of package simple-mtpfs, type "Y"

#create script droidfile with above text and make it executable

#to mount the phone at $HOME/phone
mkdir $HOME/phone
( echo 3 ; echo 1) |    droidfile

At this point, i can use a coreutils like ls etc and any file manager on $HOME/phone. Note that without the "enable-move" option to simple-mtpfs , you won't be able to use mv. And if you do enable it, it can be very slow.

to unmount, just

(echo 4; echo 1) | droidfile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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