Linux command to copy a file to a remote server

From the man page:
scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh.


Examples

Copy one single local file to a remote destination
scp /path/to/source-file user@host:/path/to/destination-folder/
So, if you wan to copy the file /home/user/table.csv to a remote host named host.example.com and copy there to jane's home folder, use this command.
scp /home/user/table.csv jane@host.example.com:/home/jane/
Copy one single file from a remote server to your current local server
scp user@host:/path/to/source-file /path/to/destination-folder
Let's say now you want to copy the same file from jane's home folder in host.example.com to your local home folder.
scp jane@host.example.com:/home/jane/table.csv /home/user/
Copy one single file from a remote server to another remote server
With scp you can copy files between remote servers from a third server without the need to ssh into any of them, all weight lifting will be done by scp itself.
scp user1@server1:/path/to/file user2@server2:/path/to/folder/
Let's say now you want to copy the same table file from jane's home folder to pete's home folder in another remote machine.
scp jane@host.example.com:/home/jane/table.csv pete@host2.example.com:/home/pete/
Copy one single file from a remote host to the same remote host in another location
scp jane@host.example.com:/home/jane/table.csv pete@host.example.com:/home/pete/
This time, you will be copying from one host to the same host, but on different folders under the control of different users.


Method 1:
You can use the 'scp' (secure copy) command to do this:

scp file.jar myUserName@boxName:/path/to/destination 

Where: 
  • boxName: Server address
  • myUserName: Id which has access to that server
Method 2:
Most of the ssh enabled boxes have sftp enabled.
You can try to sftp to the box using

sftp myUserName@boxName
put filename
Linux command to copy a file from a remote server to local:
And, to get it back (to your current directory), just reverse the arguments:
scp myUserName@boxName:/path/to/destination/file.jar

Comments

  1. Linux Command To Copy A File To A Remote Server >>>>> Download Now

    >>>>> Download Full

    Linux Command To Copy A File To A Remote Server >>>>> Download LINK

    >>>>> Download Now

    Linux Command To Copy A File To A Remote Server >>>>> Download Full

    >>>>> Download LINK 3j

    ReplyDelete

Post a Comment