I added my Google Drive to Online Accounts as described in How to Access your Google Drive Account in Ubuntu 18.04 LTS.

It works fine from the graphic interface:

enter image description here

But how do I access it through the file-system from the command line?

UPDATE: I've found this:

$ mount | grep gv
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)

$ cd /run/user/1000/gvfs/google-drive:host=gmail.com,user=butterworth.ray

$ ls -lgAFt
ls: cannot read symbolic link '1PhljWusfB-JWfKSu3xqzSzCOqztgDTEDWqfG3E2KioQ': Function not implemented
ls: cannot read symbolic link '12TmyqxUuLFQIktoec0Pe2ygDVPVx9YsDfi6tS2hAXFc': Function not implemented
ls: cannot read symbolic link '1uUnjOG172XdBQ1fLe6AbslNjsHiTK-IaUpzImwkwSbc': Function not implemented

total 0
lrw------- 1 ray 0 Jan 19 15:56 1IkBP3RVzCkMPO8UYI8LFyLo71rCOhbEirSMuS39GxUc
lrw------- 1 ray 0 Jan  5 10:06 1JkZJuIN4U-XwOLfKmYr3-0Y2KYQMQ_EmVrZPj1i1AMI
lrw------- 1 ray 0 Jun 15  2018 12TmyqxUuLFQIktoec0Pe2ygDVPVx9YsDfi6tS2hAXFc
drwx------ 1 ray 0 Jun 15  2018 1E3zpESlcc90ZmhjztC4HD22chifWHUkk/
lrw------- 1 ray 0 Jun 15  2018 1uUnjOG172XdBQ1fLe6AbslNjsHiTK-IaUpzImwkwSbc
lrw------- 1 ray 0 Jun 15  2018 1PhljWusfB-JWfKSu3xqzSzCOqztgDTEDWqfG3E2KioQ

The entries correspond to the Google-Drive data,but the file-system sees them all as bad symlinks, except for the sub-directory, which in turn contains bad symlinks.


Properties box, showing parent folder as "google-drive://butterworth..."

Perhaps I need to create an /etc/fstab entry? If so, what would be suitable?

  • In my case, cd ~/ then ls shows a directory google-drive. cd google-drive then ls lists the files in the drive. – Graham Apr 25 at 7:48
  • @Graham, other than a couple of linux-headers, sudo find / -iname "google*" | grep -i drive finds only .local/share/gvfs-metadata/google-drive:host=gmail.com,user=butterworth.ray and .local/share/gvfs-metadata/google-drive:host=gmail.com,user=butterworth.ray-e4416c84.log, both of which are small non-ascii files. – Ray Butterworth Apr 25 at 13:37
  • ok but if you just type 'ls' in a freshly opened terminal (so you will be in /home) do you get a listing for something representing 'google-drive' or similar in blue colour (indicating a directory)? – Graham Apr 26 at 8:49

Since you can use the UI, why not try opening your google-drive and select a random file within by right clicking on it and go to Properties which will show the location of the parent folder:

enter image description here

That information can then be used in the terminal to access it from the command line.

enter image description here

  • Good suggestion, but, as now shown in the question, the parent folder is google-drive://butterworth.ray@gmail.com/. – Ray Butterworth Apr 26 at 16:03
  • @RayButterworth Maybe also look at this link: linuxconfig.org/… – Graham Apr 26 at 17:59

Hmmm, I see what you mean.

You can get some more info out like this:

First, find the base URL for your google drive like this:

BASE_URL=`gio mount -li | egrep '^Mount.*google-drive' | sed 's/.*> //'`

Mine is like: google-drive://xxx_my_address_xxx@gmail.com/.

Then you can use gio again to list properties like this:

$ gio list -a 'standard::display-name' "$BASE_URL"
1t1221oLkvviV7UXqBjXmWKipT_w    0   (shortcut)  standard::display-name=Swifty14
1h332234_ZoCetVVCpwbdzoeh1_Y    0   (shortcut)  standard::display-name=Holls 2016

I mean it's still not nice, but it gets you somewhere! This cleans it up a bit:

$ gio list -a 'standard::display-name' "$BASE_URL" | awk '{print $1 "\t" $4}' | sed 's/standard::display-name=//'
1t1221oLkvviV7UXqBjXmWKipT_w    Swifty14
1h332234_ZoCetVVCpwbdzoeh1_Y    Holls 2016

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.