Coping files between computers with scp

You can use scp (Secure CoPy) to copy files from one computer to another across any network, for example backup files. Files can be copied from a remote server to your own computer, vice versa, or even directly between remote computers.

scp assumes the source computer requires authentication. If the source file is world readable, use wget instead of scp.

COPYING FROM A REMOTE SERVER TO YOUR LOCAL BOX
In a terminal on your local box, cd to the destination directory, and:

scp user@source.example.com:path/to/source/file .

Notice the trailing dot, which indicates that the file should be copied to the working directory with the same name as the original file.

COPYING FROM YOUR LOCAL BOX TO A REMOTE SERVER
In a terminal on your local box, cd to the source directory, and:

scp filename user@destination.example.com:path/to/destination/directory/

COPYING FROM ONE REMOTE SERVER TO ANOTHER
Using ssh, log in to the destination computer, cd to the destination directory, and:

scp user@source.destination.com:full/path/to/filename .

Notice the trailing dot.

USEFUL OPTIONS

  • -C: Use ssh compression. man ssh says “compression is desirable on modem lines and other slow connections, but will only slow down things on fast networks.”
  • -p: Preserves modification times, access times, and modes from the original file. Use with care.

See the references and man scp for more useful options.

REFERENCES
SSH and SCP: Howto, tips & tricks

Advertisements

About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

3 Responses to Coping files between computers with scp

  1. Pingback: Installing and configuring Joomla | Warren's tech notes

  2. Pingback: Selecting and installing Joomla extensions | A maze of twisty little passages

  3. Pingback: Updating Joomla 1.0 and 1.5 | A maze of twisty little passages

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s