Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently aware of SCP and SSH. There are times when I'm doing some work within a file that I need to download it locally to work on it. Which invokes:

  1. Print the working Directory/Path

  2. Get File name

  3. Fire up new terminal window and do scp myName@host:/Path/to/file/fileName.someExt ~/MyLocalPath

That works great, but it's a major pain in the ass. Is there an easy way to copy a file from a remote server over SSH without using the steps above?

Edit: I am looking for a way to transfer the files from the command line, while I am removed into the box. That way I can run commands and not just copy files.

share|improve this question
If the machine you want to transfer the file to accepts ssh connections, just run scp on the remote machine to transfer the file where you want it. – David Schwartz Oct 3 '11 at 2:22
I'm behind a router and firewall. Not ideal. – Snow_Mac Oct 3 '11 at 2:35
I might be misunderstanding your question, but if you want an easier way to copy files with ssh, you can use the FISH kioslave (if you're using KDE) or GVFS (if you're using GNOME). – user55325 Oct 3 '11 at 2:38
I'm looking for a way to transfer from the command line, no from a GUI. Basically I ssh into a box. something like SomeCommand FileOnHost ~/localPath would be ideal. Think of the connection as both a shell and a bridge for files and commands. – Snow_Mac Oct 4 '11 at 4:37
up vote 2 down vote accepted

You can use a FUSE application to mount remote files to the local filesystem. Then you can work on the files directly. When you change them, they will be changed on the remote end automatically.

First make sure you have the fuse kernel module loaded or built-in.

Then you can use either sshfs, which is a standalone application:

sshfs user@hostname: mountpoint # to mount to mountpoint
fusermount -u mountpoint # to unmount

Alternatively, you can use GVFS. If your're in a desktop, just type this into the file manager (or use gvfs-mount in command line):


And the filesystem will be mounted to

$HOME/.gvfs/sftp for user on hostname

If however you're not in a desktop, you'll have to start a D-Bus session before you can use gvfs-mount:

$ dbus-launch 
No protocol specified
$ export DBUS_SESSION_BUS_ADDRESS=XXXXXX # copy value from above

You can automate the above by a shell script which you source (!).

share|improve this answer
I very much like FUSE/sshfs, but this is a Linux-only solution. – eldering Oct 3 '11 at 8:02
eldering: FUSE is far from being Linux-only. According to Wikipedia, it's available for Linux, FreeBSD, NetBSD, OpenSolaris, and Mac OS X. – Ambroz Bizjak Oct 3 '11 at 9:38

I don't know of any native method, but there is a patch, "ssh-xfer":

ssh-xfer is a hackish but handy way of transferring files from remote hosts to your local computer. Firstly, you need to run a slightly modified SSH authentication agent program on your local computer. Patches are available for both OpenSSH and PuTTY . . .

I haven't tried it myself, so no promises here. It looks like you have to install ssh-xfer on the remote host, so that may not work out if you don't own the machine (shell account, etc.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .