Jump to: navigation, search

Learning scp commend for file transfer

From w3cyberlearnings

Contents

Transfer/copy all the folders from a remote server to the local server(Remote->Local)

  • Remote server:10.8.4.128
  • Login user name for the remote server: root
  • File path in the remote server: /var/allmyfile/*
  • File to store on my local host: /home/paul/system/temp

This command will copy all the file under the /var/allmyfile/ folder. Check the file size from the remote server and your local disk space to make sure you have enough disk space!!

 $ scp -r [email protected]:/var/allmyfile/* /home/paul/system/temp

Transfer/copy all the folders from localhost to the remote server (Local->Remote)

bob@ubuntu:/home/sophal/Downloads# scp -r myfolder [email protected]:/home/john

Transfer/copy one or many files from remote server to local server(Remote->Local)

Here, I copy file doc1.doc on /home/bob/doc directory from a remote server with the IP address 10.8.4.129 to /home/docall directory on the local host.

root@ubuntu:~# scp [email protected]:/home/bob/doc/doc1.doc /home/docall

Transfer/copy one or many files from local server to remote server and store on the user home directory(Local->Remote)

bob@ubuntu:/home/sophal/Downloads# scp -r alfresco-community-4.0.c-installer-linux-x64.bin [email protected]:~

Transfer/copy all files in a directory from the remote server to the current directory (Remote->Local current directory)

 $scp -r [email protected]:/var/mycollect/data .

Transfer/copy all files in the current directory from the Local server to remote server (Local->Remote)

 $scp -r * [email protected]:/var/mypublic/site

Transfer/copy all files in a directory from the remote server to your home directory (Remote->Local home directory)

 $scp -r [email protected]:/var/mycollect/data ~

Transfer/copy hello.txt file in a directory from the remote server to your home directory (Remote->Local home directory)

 $scp [email protected]:/home/sophal/hello.txt ~

Transfer/copy hello.txt file from a remote server to a remote server (Remote -> Remote)

You copy doc.txt file from remote1.net on the directory /path/to/desired/ to another the directory /path/directory/mydoc on remote host called remote2.ex. You will prompt for the password when you press enter.

$scp [email protected]:/path/to/desired/doc.txt [email protected]:/path/directory/mydoc
Navigation
Web
SQL
MISC
References