I am logged to remote server via ssh (linux) or via putty(windows). I want to copy file back to my origin machine from remote bash prompt (because of convenience). I know I can launch FileZilla or WinSCP at my machine and copy files, but I would like to know how to do that from remote bash prompt.
I know I can copy files via pscp using another ssh link:
pscp server.file localuser@local:/local_path
But this is impossible to use if client does not run a openssh server.
I see that my server has some variables like SSH_CLIENT, SSH_CONNECTION etc. Is it possible to use this information to craft a command like this?
copy_from_server server.file local.file
Where server.file is file located on the server (local to bash prompt where copy_from_server runs) and local.file is destination on client machine where file should be copied.
I would like a solution that works for windows and linux but I am also open to solutions that work on linux only or on windows only.
EDIT: Similar questions:
tar -cf - /some/file | ssh host.name tar -xf - -C /destination
would be how to do that. Note that for a variety of reasons, it's usually better to just use software more suited to the task, but it will work in a pinch.