RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

scp

Article Index
1. Name
2. Synopsis
3. Frequently used options
4. Examples

1. Name

scp [man page] - secure copy (remote file copy program)

2. Synopsis

scp [-1246BCpqrv] [-c cipher] [-F ssh_config]
    [-i identity_file] [-l limit] 
    [-o ssh_option] [-P port] [-S program]
    [[user@]host1:]file1 [...] 
    [[user@]host2:]file2 

3. Frequently used options

-p      Preserves modification times, access times,
        and modes from the original file.
-q      Disables the progress meter.
-r      Recursively copy entire directories.
-v      Verbose mode.  Causes scp and ssh(1) to print
        debugging messages about their progress. 
        This is helpful in debugging connection,
        authentication, and configuration problems. 

4. Examples

scp is largely replacing unsecured rcp protocol. Therefore for data copy over the internet scp is suggested of rcp. Scp can can be used to upload data as well as download data. First we upload data from our local box to remote. We are about to transfer file myscpfile.txt from linuxconfig.local to linuxconfig.org's /tmp directory. For this we need to know valid user name and password for linuxconfig.org. In this case the user name is linuxconfig. SYNTAX:

scp [local file to copy] [username]@[host]:/[remote directory to copy file in] 
scp myscpfile.txt linuxconfig@linuxconfig.org:/tmp 

Using scp linux command to copy file from local to remote
Now we can scp the file back to our local /tmp directory: SYNTAX:

scp [username]@[host]:/[remote file to copy] [local directory to copy file in] 
scp linuxconfig@linuxconfig.org:/tmp/myscpfile.txt /tmp 

Using scp linux command to copy file from remote to to local
This works fine for the files, but what about directory copy. For directory we need to use scp's -r option. Let's copy directory from local to remote and back. As shown on the figure below, not using -r option does not work for directory's. You get following error:

scp: /tmp/dir1: not a regular file 

Using scp linux command to recursive directory remote copy

Share this linux post:

Submit scp in Delicious Submit scp in Digg Submit scp in FaceBook Submit scp in Google Bookmarks Submit scp in Stumbleupon Submit scp in Technorati Submit scp in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download