I want to mount/unmount my google drive using google-drive-ocamlfuse
with a key binding without having to open a terminal. How can I set this up?

- 39,982
2 Answers
Short answer:
Mounting
/bin/bash -c "google-drive-ocamlfuse ~/path/to/foldershowinggoogledrive"
where path/to/foldershowinggoogledrive
is the path relative to your homedir.
e.g. /home/you/googledrive
-> ~/googledrive
No need for sudo!
Unmounting
Similarly, to unmount, if you use ~
, you should use in a shortcut:
/bin/bash -c "fusermount -u ~/relative/mountpount"
Or if you use absolute path:
fusermount -u /absolute/path/to/mountpoint
Why /bin/bash -c?
You could use
google-drive-ocamlfuse /absolute/path/to/folder
but since you are using ~
, you need the expansion handled by bash.
Binding commands has been explained within How to bind custom commands to keyboard shortcuts?: System Settings -> Keyboard -> Custom Shortcuts -> + button
EDIT
Just noticed ODrive which works substantially different. ODrive actually downloads the files and synchronizes with Google Drive, similar to how the Windows version of Google Drive works.
The big advantage -at least to my experience- is the immediate response to editing & saving, while the previously mentioned solutions have a huge delay on the work process during saving.

- 83,767
-
https://imgur.com/Ae2TKZA – EODCraft Staff Feb 11 '19 at 23:15
-
@EODCraftStaff SOmething must be wrong in your setup or your account. This is the official command. Using it everyday. – Jacob Vlijm Feb 11 '19 at 23:24
-
@EODCraftStaff That' s a bummer. Just tried a second ago to be absolutely sure. It works. – Jacob Vlijm Feb 11 '19 at 23:27
-
@EODCraftStaff 15 GB of google drive should be free, so depending on your needs you may not have to buy anything at all – Sergiy Kolodyazhnyy Feb 12 '19 at 01:30
-
1I think your box is messed up. It's a one-time thing normally @EODCraftStaff – Jacob Vlijm Feb 12 '19 at 10:38
-
Thanks for that advice! Deleted the .gdfuse folder re-did it and all worked! – EODCraft Staff Feb 12 '19 at 10:52
-
@EODCraftStaff Yay! glad it works :) – Jacob Vlijm Feb 12 '19 at 11:39
Gnome online accounts can do this for you. It may be already installed but if not you can find it in the software center or download it for your Ubuntu version and architecture here. Now you can connect your google account to gnome through Settings->Online Accounts. If Online Accounts isn't present in the list log out and back in again.
Choose Google from the list of Online Accounts and sign in with your credentials.
Gnome will request permissions to Access which you'll have to accept. If you are asked for your keyring password (usually your login password) provide it.
Click on the Google Account.
Flip the files switch on and then close the Window.
Open Nautilus and you should see a networked drive option that matches your google account on the left pane. Click on that and enjoy access to your google drive!
Sources:
https://www.maketecheasier.com/mount-google-drive-ubuntu/
Testing

- 36,023
- 25
- 98
- 183
-
Both options are not optimal if it comes to read/write speed. OP's option reads/writes slow, but still substantially faster than this one. – Jacob Vlijm Feb 11 '19 at 23:02
-
"Click on the Google Account Flip the files switch on and close the Window." Consider rewriting this sentence a bit. I found it a little unclear. There's a flip switch ? or is it called Google Account Flip menu ? Otherwise, +1 – Sergiy Kolodyazhnyy Feb 12 '19 at 01:28
-