Ubuntu: open remote (ssh) file locally via comand line (without installing sshfs)


currently I use Nautilus to connect to server, and then double click on the files I want to open. I am trying to figure out a way to do this purely from terminal. The internet revealed sshfs, but that is not currently installed, and since Nautilus can do it already, I should be able to replicate that behavoir without installing anything new, right?

I guess what I am really trying to do is replicate the behavoir of nautilus's connecting to a sever in the command line. Right now these are the options I have found and the reasons they aren't quite what I am looking for

  1. ssh -X USER@SERVER.ETC After connecting, I can open files, but they aren't opened remotely. This is great, but there is a performance penalty (gui lags) as compared to opening the files locally, and critically for me audio is not present.
  2. sftp is great, but I can't open files from the sftp command prompt. gvfs-open yields Invalid command. If instead I do

    !gvfs-open sftp://SERVER/PATH_TO_FILE

    I get the following error

    gvfs-open: sftp://SERVER/PAth_TO_FILE: error opening location: The specified location is not mounted Shell exited with status 2

If I connect to the server via Nautilus first (and this is an sftp conection) I can execute gvfs-open sftp://SERVER/PATH_TO_FILE and open the file locally. How do I do this purely from the terminal? And what is Nautilus doing differently than executing sftp from the terminal? Thank you!


What you can do in your command line workflow is:

  • Start with gvfs-mount ssh://your-server/
  • then access files normally with local applications - for example, gedit /run/user/1000/gvfs/sftp:host=your-server/path/to/file.txt

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »