3

I've mounted a networked filesystem in GNOME by clicking on the icon in the left of Nautilus. However, when I use the terminal, I can't figure out how to access that filesystem. Is it possible?

5

Nautilus uses GVFS to mount networked filesystems. Unlike its predecessor GnomeVFS, GVFS includes a FUSE bridge so that non GVFS-aware applications can still access GVFS data.

That means that there are two ways to do this: using the FUSE bridge, or using the native GVFS tools.

Using the FUSE bridge

According to man gvfsd-fuse, the GVFS daemon will mount bridges either at $XDG_RUNTIME_DIR/gvfs or $HOME/.gvfs. You should first check in $HOME/.gvfs.

$ ls ~/.gvfs

If it's there, great. All your networked, Nautilus-mounted filesystems should be shown as subdirectories.

However, on my system (Arch GNU/Linux, GNOME 3.10), that directory doesn't exist. Therefore, you need to look in $XDG_RUNTIME_DIR/gvfs. On my system, this ends up being /run/user/$UID/gvfs, where $UID is your user id. As above, your mounts will be a subdirectory of this directory. You can use ordinary tools, like ls, cat, $EDITOR, etc. to work with the contents of these subdirectories.

Using the native GVFS tools

GVFS provides the gvfs-* family of tools to natively interact with GVFS. For example, gvfs-cat is just like regular cat, but it is GVFS-aware.

All network mounts are referenced in the special GVFS computer:/// location. We need to get what they reference.

$ gvfs-tree computer:///
computer:///
|-- APPLE SD Card Reader.drive
|-- HL-DT-STDVDRW  GA32N.drive -> burn:///
|-- ST31000528AS.drive -> file:///run/media/alex/Macintosh%20HD
|-- root.link -> file:///
`-- strugee@my.owndrive.com.volume -> davs://strugee@my.owndrive.com/remote.php/webdav

In this listing, you can see my SD card reader, my optical drive, a different partition on my internal drive (mounted), a representation of the filesystem root, and finally, the networked filesystem that we're interested in (an OwnCloud account). Notice that this command indicates links.

Now that we have the address for the networked filesystem, we can use GVFS tools to look at it. For example, let's list the contents of my OwnCloud.

$ gvfs-ls davs://strugee@my.owndrive.com/remote.php/webdav
Introduction to Arch Linux.odp

Looks like I don't have too much there. Let's create a new file. Now, GVFS doesn't have a tool like touch, but it does have a tool to save files. We can just save an empty file.

$ gvfs-save davs://strugee@my.owndrive.com/remote.php/webdav/foobar.txt

gvfs-save will wait for you to type something. Since we don't actually want anything to be in this file, hit Ctrl-D to save.

Now we can open this file with the default handler for it.

$ gvfs-open davs://strugee@my.owndrive.com/remote.php/webdav/foobar.txt

It's worth noting that if you don't give it a file extension, the file won't open. This is because gvfs-open will throw an error about not knowing which application should be used to handle the file. (If you made this mistake, fix it with gvfs-move.)

You can list all the GVFS commandline tools with a simple ls.

$ ls /usr/bin/gvfs-*

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.