Address to Google Drive via Terminal

On my old PC with Fedora 35 I have the Google-Drive folder in the ‘Files’. But I don’t know how to access these directory via Terminal. I’ve used df or mount commands, but there is no Google Drive directory. Although, I know when I click on this Google-Drive directory it “mounts” in the system. Maybe it’s not the ‘mount’ command, but another way to share Google Drive on Fedora?

Could I address this directory in Terminal, or it’s not a directory?

1 Like

I opened my Google Drive in nautilus (Files), and then right clicked and selected “Open in Terminal”. This opened a terminal at:

/run/user/1000/gvfs/,user=<google username>

So, once you’ve accessed it in Files to ensure it’s mounted, look into /run/user/<uid>/gvfs/ to see if it’s there.

You will be able to get your uid using id -u

Ankur, you are absolutely right! I can see this directory in Nautilus, but all files have random abracadabra names.

lrw-------. 1 Ilya Ilya    0 июн 20  2019 15HR_IBTXIjtyzCkOcCpi2PEBL6DeKOPD
lrw-------. 1 Ilya Ilya    0 апр 26  2020 16w622g3HIc951zMJW0J-hRlBqTXliuQA5DlbnLC0w78
lrw-------. 1 Ilya Ilya    0 июл 26 09:48 19WK2UUVB7_TjLeAOTXEdntDjIe6Kxikc5fcDirVZOxA
lrw-------. 1 Ilya Ilya    0 янв 20  2022 1BAA2wtnshTC-TZ0XmCl888XE9J1_BM0-zsY7T8A4w1o
-rw-------. 1 Ilya Ilya 658K фев  1 10:54 1BfOZg0gKuGPdfE7XYi15AmBIKFEvFoom
lrw-------. 1 Ilya Ilya    0 мар 27 20:00 1bpxbM20jsZ9vmA-AkAMzW6ZBtIuJoLlTJN1TiQy4v5w
lrw-------. 1 Ilya Ilya    0 мар  8  2015 1BVeeOuU8of12Pa1JaX_nrYg3q3CY9QwFf8u0xbCCxRA
drwx------. 1 Ilya Ilya    0 окт  2  2021 1CejRr6yC0SseDPiB5tf7E6a65MkdsQ0z

I found this issue last year when I tried to attach documents from Google Drive into Gmail. I think it’s Fedora’s problem.

No, it isn’t “Fedora’s problem”. Files on a Google drive are not stored like normal files using their “pretty names”. They are stored using some other generated names (not a clue how these are generated). Google drive has an API which allows it to be “mounted” for users to view files and work with them. gvfs includes support to do this, and through gvfs, nautilus has the required support to read the metadata of the files to list them by their “pretty names”. What we’re seeing at the moment in the terminal is the gvfs mount.

See more here:

The terminal command, ls (and any other command that is not aware of this being a Google drive), on the other hand has no idea that this is a special Google drive where files need to be listed in a different way. For it, the files are just that, files—they’re not special in anyway. So ls cannot automatically list the files using their “pretty names”, it lists them using whatever file name they are listed with.

I searched a bit and found some gvfs commands that should get the pretty names etc, for example:

These were deprecated from gvfs at some point, and now we can use the gio commands:

Here’s the commit with some more information:

So, in your Google drive directory, try this:

gio ls -d

and that should list your files with “pretty names”. See man gio for more.

There are also other tools like rclone for mounting these, but again even with rclone, it looks like you have to use rclone specific commands to list contents of the drive, eg. rclone ls .... One still can’t just use ls because of the way the files are stored.


A post was split to a new topic: Symbolic link to file stored on mounted Google Drive