Friday, May 30, 2008

Playing around with ~/.gvfs/

A few days ago I discovered that I had a new folder, named .gvfs/ in my home directory, so I started some digging on what that was good for. Turned out that gvfs in combination with gio is a replacement for gnome-vfs. So here some things you can do with gvfs. First of there is a heap of new tools, called gvfs-*, there are things like gvfs-mkdir, gvfs-ls and such. They work similar to the regular Unix tools except that they work on top of gvfs and gvfs can, as gnome-vfs before, do fun stuff like access the http or ssh, so you can do things like:

% gvfs-cat

Which is cool, but not yet all that exciting, since you could do the same thing with curl. It becomes more interesting when you access a filesystem via ssh, for example stuff like:

% gvfs-cat ssh://user@host/home/user/.bashrc

You might notice that the ssh example will not work out of the box, complaining about stuff not being mounted. So we do a:

% gvfs-mount ssh://user@host

And it will work then. This brings us back to ~/.gvfs/, which is used to store the mounted directories. If you go there you will find that you now have a directory called ~/.gvfs/sftp on host which you can access normally with all your everyday Unix tools. You can of course also mount samba directories the same way:

% gvfs-mount smb://host/share

Doing a:

% ls -l /usr/lib/gvfs/gvfsd-*

Will show you all the available backends.

No comments: