Skip to content

Instantly share code, notes, and snippets.

@rcfrias
Created September 27, 2014 21:08
Show Gist options
  • Save rcfrias/d7d89bef60769bc9bc5d to your computer and use it in GitHub Desktop.
Save rcfrias/d7d89bef60769bc9bc5d to your computer and use it in GitHub Desktop.
Transfer files and/or folders between 2 remote linux servers using sftp and ssh
* Assuming we have 2 remote linux servers running Ubuntu A and B. Using a Mac and Terminal to run the commands.
1. Connect to one remote server from your computer ( A )
a) Open Terminal and access the remote server using ssh.
Example: ssh -l user server (name or ip)
2. Make the remote server A connect to B using sftp:
Example: sftp username@remote_hostname_or_IP
3. Use the command pwd to print the current REMOTE working directory (Server B).
4. Use the command lpwd to print the current LOCAL working directory (Server A).
5. Use ls command and cd command to navigate the REMOTE server A.
6. Use lls command and lcd command to navigate the REMOTE server A.
7. Use the command put, to transfer 1 file from A to B
Example: put localFile
8. Use the command get to transfer 1 file from B to A.
Example: get remoteFile
9. Add the -r flag when refering to folders.
10. df -h checks available space in B
11.
!
df -h
checks available space in A.
12. exit to leave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment