Copy from remote server to my laptop via ssh

25,765

Solution 1

scp [email protected]:foobar.txt /some/local/directory

This Reference may help.

Solution 2

$ scp user@server:/app/dump.dat /home/

For a path relative to your home dir miss out the first /

Take a look at the scp man page for more detail.

Solution 3

rsync is generally a better option. It is restartable, for one thing. Also, it is generally faster. See man rsync for tons of options.

rsync -abvz [email protected]:foobar.txt /some/local/directory

rsync is probably configured to use ssh by default, but if you want to be extra careful you can do

rsync -abvz -e ssh [email protected]:foobar.txt /some/local/directory
Share:
25,765

Related videos on Youtube

fl00r
Author by

fl00r

I am not funny

Updated on September 17, 2022

Comments

  • fl00r
    fl00r over 1 year

    I am on centos server (via SSH) and I don't want to open file manager to copy dump file. What comand whould I use (scp or what) to copy that file from remote server directly to my comp.

    like

    cp ssh://user@server/app/dump.dat /home/
    

    UPD

    even more interested in how to copy file from my ssh session while I am on server back to my PC (of course I can logout or open new terminal tab or start up SSH server on PC)

  • fl00r
    fl00r about 13 years
    and how to use scp vice versa when I am on my remote server?
  • user1686
    user1686 about 13 years
    @fl00r: Start the SSH server on your PC, then use scp
  • fl00r
    fl00r about 13 years
    as I thought :) But I don't want to start ssh server. thx
  • FJ de Brienne
    FJ de Brienne about 13 years
    If you're behind a firewall or behind NAT the only way without setting up port forwarding is to use a 'client pull' system (scp run locally) or to tunnel something back down through the SSH channel with SSH's port tunneling. What you'd use for that is anyone's guess, but you'd need to start some form of server on your local machine - be it sshd, ftpd, or whatever.
  • FJ de Brienne
    FJ de Brienne about 13 years
    unless the terminal you are using supports something like zmodem then you could use sz to send the file as if you were on a slow serial connection... smirk