Skip navigation

A little gem I learned today when needing to get a file from a remote system that I’d sshed into onto my local machine so that I could manipulate it while offline: the scp command.

There are a lot of switches for scp, but if you’re trying to get a file to or from a remote machine, or even between two remote machines, both of which you are able to ssh into, here’s the syntax:

scp -P 22 [user@source.machine.address.if.remote:]/directory/of/file/to/copy [user@target.machine.if.remote:]/target/directory

In the above example, the -P flag is indicating the port (in this case, we’re using port 22 because we’re logging in using ssh).

If you’ve typed everything correctly, you’ll then be prompted for the password of the user at the remote machine (or the first one, if you’re moving files between two remote machines). After entering everything correctly, you should see a new line indicating the current file being transferred, the percentage transferred (this will update live), number of bytes transferred, transfer speed, and elapsed time. If you’re just copying a small text file, this will flash by faster than you can really comprehend, and you’ll be deposited back at the command prompt before you know it.


One Trackback/Pingback

  1. By Cisco Weight Loss Addendum | Beep Boop on 29 Jan 2014 at 9:11 am

    […] to have my tftp requests time out.  A quick ? showed me that I could instead use scp (which has made appearances on this blog before), but the syntax was left as a mystery to me.  I have finally found the […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: